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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -