javascript - Defining a click event programmatically -


i creating dynamic anchor tag this

 var anch = $('<a />', {                         'href': '#' + ctrlid,                         'text': text                     }) 

how add click event while creating tag automatically calls function funcone(ctrlid) , passes ctrlid?

i tried no luck

 var anch = $('<a />', {                         'href': '#' + ctrlid,                         'text': text,                         'onclick': funcone(ctrlid)                     }) 

var anch = $('<a />', {     'href': '#' + text,     'text': text,      on: {          click: function () {             //          },          someotherevent: function () {             //          }      } }); 

demo.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -