Files
grecia/app/assets/javascripts/check_all_none.js
Javi Martín f8c9f09887 Prevent default event on JavaScript-only links
These links point to "#" and don't do anything without JavaScript
activated, and they were causing the browser to scroll to the top of the
page.
2020-08-05 14:10:22 +02:00

22 lines
631 B
JavaScript

(function() {
"use strict";
App.CheckAllNone = {
initialize: function() {
$("[data-check-all]").on("click", function(e) {
var target_name;
e.preventDefault();
e.stopPropagation();
target_name = $(this).data("check-all");
$("[name='" + target_name + "']").prop("checked", true);
});
$("[data-check-none]").on("click", function(e) {
var target_name;
e.preventDefault();
e.stopPropagation();
target_name = $(this).data("check-none");
$("[name='" + target_name + "']").prop("checked", false);
});
}
};
}).call(this);