I want to bind a click even to the dynamically added span elements to a node on my page. I wrote the bind event for a single static element and it works fine -
function clickSpan(domNode){
$(domNode).find("span").bind("click", function(){
alert("span clicked");
});
}
I tried writing the same for dynamically added elements and changed the "bind" to the "on" method. Somehow this doesn't work for the dynamically added span elements. How do i make the dynamically added span elements to respond to clicks?