Files
grecia/app/assets/javascripts/check_all_none.js
2024-06-06 16:28:19 +02:00

17 lines
544 B
JavaScript

(function() {
"use strict";
App.CheckAllNone = {
initialize: function() {
$("[data-check-all]").on("click", function() {
App.CheckAllNone.associated_fields($(this), "check-all").prop("checked", true);
});
$("[data-check-none]").on("click", function() {
App.CheckAllNone.associated_fields($(this), "check-none").prop("checked", false);
});
},
associated_fields: function(element, data_attribute) {
return $("[name='" + element.data(data_attribute) + "']");
}
};
}).call(this);