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

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -