P
P
pratamishus2011-12-04 15:08:21
JavaScript
pratamishus, 2011-12-04 15:08:21

jQuery or JavaScript: How to check if a user has clicked on an anchor link?

I wish you good health, habrovtsy!

I've climbed the whole net, but I couldn't even form a normal question for the search :). So the question is:

I have a bookmark link,



I need it so that when the user clicks on this link, an event is called for jquery or javascript. For example:

I have a link in the code as above. I sent a link to the user's mail

preloaders.net/ru/3d/#mylink

And when the user follows this link, in my jquery I want to do something like

$(document).ready(function(){<br/>
<br/>
$('.myclass').click(function(){<br/>
 alert($(this).attr('name'));<br/>
 });<br/>
<br/>
});<br/>


Does anyone know how to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Burov, 2011-12-04
@pratamishus

If I understand you correctly, then:

$(document).ready(function(){
  if (document.location.hash=='#mylink'){
    alert();
  }
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question