binding - JQuery bind function to multiple objects -


how can edit code below bind function both mylink , mybutton.

if (section === x) {     mybutton = $("#a");     mylink = $("#b"); } else {     mybutton = $("#c");     mylink = $("#d"); }  mylink.click(function(e) {      e.preventdefault();     showmydialog(); }); 

if (section === x) {     $("#a,#b").click(onclick); } else {     $("#c,#d").click(onclick); }  function onclick(e) {      e.preventdefault();     showmydialog(); }); 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -