I am adding tag at run time using jquery.
<a id=add class=add href=#>Test</a>
I want to fire the click event of this tag but it doesn’t get fired.
I have already tried
$('#add').bind('click', function(e) {
e.preventDefault();
alert('hello');
});
but nothing happens.
You need to bind it using .live()
The .live() method is able to affect elements that have not yet been added to the DOM through the use of event delegation.
http://api.jquery.com/live/