Reputation: 157
I'm a dizzy designer. I can't can't see why this isn't working:
<head>
<script type="text/javascript">
$().ready(function() {
$('#test').trigger("click");
});
</script>
</head>
<body>
<a id="test" href="http://www.dartworks.net" >click here</a>
</body>
what am i doing wrong?
Upvotes: 0
Views: 471
Reputation: 1035
you didn't attach any click event to the <a>
tag you just output it as a link
use the window.location.href like this :
$(document).ready(function() {
window.location.href = "http://www.dartworks.net";
});
Upvotes: 1
Reputation: 943979
The trigger method will fire all the event handlers bound to that event. Following the link is default behaviour, not something caused by a DOM event handler.
Upvotes: 1