Profile photo for Singh Naina

If you want to have a click event on an element then simply add the click event for that element and forget the rest. In your case you have an anchor, just give your anchor some id and add the click event in jQuery like this:

  1. <a id="myAnc" href="#">Click Here</a> 
  2. $("#myAnc").click(function() { 
  3. alert("Your anchor is clicked."); 
  4. }); 

So the above jQuery code will show alert box when the anchor is clicked.
Note: Check i have given “#” for href of anchor.

View 5 other answers to this question
About · Careers · Privacy · Terms · Contact · Languages · Your Ad Choices · Press ·
© Quora, Inc. 2025