jquery - Delegated events : selector of many elements -
i want handle 2 elements in delegated events manner :
$("#pagination_container").on("click", ".image-container", function() { var c = $("#article_"+$(this).attr("data-pk")); var q = $("#qtecmd_"+$(this).attr("data-pk")); if (c.is(":checked")) { c.prop("checked", false); q.hide(); } else { c.prop("checked", true); q.show(); } }); $("#pagination_container").on("click", "label", function() { var c = $("#article_"+$(this).attr("data-pk")); var q = $("#qtecmd_"+$(this).attr("data-pk")); if (c.is(":checked")) { c.prop("checked", false); q.hide(); } else { c.prop("checked", true); q.show(); } });
as can see same thing. possible combine these 2 handlers unique 1 select both ".image-container"
, "label"
?
comma separated
$("#pagination_container").on("click", ".image-container, label", function() {
Comments
Post a Comment