Reputation: 17
I am using the following code to simulate a click as soon as a specific page loads:
jQuery(function($){
setTimeout(function() {
$('ul.dk_options_inner li:nth-child(2) a').trigger('click');
}, 200);
});
This works in all browsers apart from IE11. Are there any alternatives ways to adjust this to ensure compatibility with IE11?
Upvotes: 0
Views: 582
Reputation: 22158
Better if you attach on document ready, that's the DOM is ready to use:
$(document).ready(function() {
$('ul.dk_options_inner li:nth-child(2) a').trigger('click');
});
You don't need to make an asynchronous method (like setTimeout()
) and it works in all browsers (mobile included)
Upvotes: 1