I came across a strange problem with html anchor tags. I have an anchor tag on the html page and on clicking the ‘a’ tag it is supposed to give me an alert message. It is working well. But, If I append a new ‘a’ tag using jquery to the html page and on click of that appended ‘a’ tag is not working. i was able to give href, target blah blah blah to the appending ‘a’ tag but.. onlick function is not working. Any thoughts ???
Thanks in advance.
In jQuery, you typically use the .click() function on a selector to set the click handler. Note that if multiple items match the selector, multiple items will have the click handler installed.
Here’s a trivial code snippet that should do what you want: