I’m trying to fire an alert when a user clicks on an anchor tag, but the alert is not being fired. The code I am trying is below.
<a id="collapse"> Collapse</a>
$(function(){
$('#collapse').click(function(){
alert('here');
});
});
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your code is ok, but you weren’t loading jQuery in your fiddle.
http://jsfiddle.net/NLdTJ/3/
P.S.:
I’ve attached your code again because SO didn’t let me post the answer with just a link to jsfiddle and no code 🙂