[ACCEPTED]-How to make onclick automatically through onload function-onclick
Accepted answer
$(document).ready(function() {
$('#someLinkId').click();
});
Or
$(document).ready(function() {
$('#someLinkId').trigger("click");
});
0
$("#whateverid").trigger("click");
Where "whateverid" is the ID of the anchor 2 tag, or whatever other selector you want 1 to use.
$(document).ready(function () {
$("#myLink").trigger('click');
});
as you can read in: http://docs.jquery.com/Events/trigger#eventdata
0
What's the point of loading the page if 3 you're going to navigate away from it immediately?
In 2 addition to jQuery's triggering abilities, you 1 could do:
<body onload="window.location.replace('http://example.com/');">
or:
<body onload="window.location.href = 'http://example.com/';">
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.