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

SAP Web Service from .NET via WCF -

Optimized Line drawing in QT -

datetime - str to time in python -