Friday 9 May 2014

Using jQuery to programmatically click an a link


<script>
$("#myAnchor").click(function(event)
{
var link = $(this);
var target = link.attr("target");
if($.trim(target).length > 0)
{
window.open(link.attr("href"), target);
}
else
{
window.location = link.attr("href");
}
event.preventDefault();
});
</script>
<html><a id=myAnchor href=index.php></a></html>