user4420583
user4420583

Reputation:

How to find anchor link within anchor tag and click on that link automatically using jquery

How to find anchor link within anchor tag and click on that link automatically in jquery.

example

<div id="myid">
<a id="interestingness" href="htttp://mylink.com">mytestinglink</a>
</div>

Upvotes: 3

Views: 531

Answers (3)

afsal
afsal

Reputation: 11

$('#interestingness').click();

Upvotes: -1

Yuyutsu
Yuyutsu

Reputation: 2527

<div id="myid">
<a id="interestingness" href="htttp://mylink.com" target="_blank">mytestinglink</a>
</div>


$("#interestingness").click(function(){
          var currentAnchor = $(this);
          alert(currentAnchor.text());
          alert(currentAnchor.attr('href'));
        });

Upvotes: 1

Christos
Christos

Reputation: 53958

You could try something like this:

$('#interestingness')[0].click();

Upvotes: 2

Related Questions