I am creating a dynamic anchor tag like this
var anch = $('<a />', {
'href': '#' + ctrlid,
'text': text
})
How do I add a click event while creating this tag that automatically calls a function say funcOne(ctrlid) and passes the ctrlid?
I tried this but no luck
var anch = $('<a />', {
'href': '#' + ctrlid,
'text': text,
'onclick': funcOne(ctrlid)
})