How To Trigger Onclick Event On An Anchor Tag After Page Load In Javascript
I was working with an html document in that i've a navigation menu. i want to trigger a click event on the home navigation in onload() iw wrote something but it wont work and i cou
Solution 1:
If you want to redirect user simulating anchor click, then call native DOM click method:
$("#menu-item-29").children('a').get(0).click();
Solution 2:
Don't forget to include JQuery source when you use $(document).ready
And children()
is a function. Look at the documentation : http://api.jquery.com/children/
Post a Comment for "How To Trigger Onclick Event On An Anchor Tag After Page Load In Javascript"