<a href='#' id='aId1'>1</a>
<a href='#' id='aId2'>2</a>
<a href='#' id='aId3'>3</a>
<a href='#' id='aId4'>4</a>
<a href='#' id='aId5'>5</a>
Is it possible to check if an anchor is clicked or not via JQuery? It should get the id of the clicked anchor, and if no anchor is clicked, it should also have an event to perform.
This will only trigger when an anchor is clicked on and stores the elements
idas a variable.If you want to prevent the default action when an anchor is clicked, add this to end of the function:
If you want mark an anchor as clicked for future reference, try this:
The, using jquery, check if it has been clicked using
If you want to listen for everything being clicked and want to see if it was an anchor, try: