my a click jquery function is not working, it just doesn’t give any errors at console at all too.
Here is the link –
<a href="#lang" id="language">Edit</a>
and here is the click function
$('a').click(function() {
var item = $(this).attr("id");
alert(item);
return false;
});
It doesn’t popout the alert box, nor it does show me error in console.
Okay, someone asked for more info –
The link is added with jquery, by pressing button, and as id it takes one of the input fields value and inserts it as link with id from input field. There are no duplicate ids, all javascript scripts are located at the end of head tag, and the a click function is located last in part.
Based on your edit that the
<a>tag is being inserted dynamically, you’ll need to use jQuery’s.on()(jQuery version 1.7 and later) or.live()method to attach the click handler.