Reputation:
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
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
Reputation: 53958
You could try something like this:
$('#interestingness')[0].click();
Upvotes: 2