Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
10
rated 0 times [  13] [ 3]  / answers: 1 / hits: 17341  / 12 Years ago, wed, may 30, 2012, 12:00:00

I am trying to figure out how to make an anchor link clicked when the website is visited. I would be grateful if someone can help me, here's a demo code, you can match the id for my ease thank you.



<body>
<a id='deepakkamat' href='http://mywebpage.com'> This is my webpage </a>
</body>


So i want to know any JavaScript code to make the link clicked when the page loads. Thank you in advance.


More From » jquery

 Answers
10

The jquery answer:



$($('#deepakkamat').click());


This will actually register a click event as the cause, but it seems awfully unnecessary. The meta method is the preferred method.


[#85266] Tuesday, May 29, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mckaylab

Total Points: 311
Total Questions: 120
Total Answers: 93

Location: Montenegro
Member since Thu, Jun 16, 2022
2 Years ago
;