网站加载时如何自动单击链接 [英] How to automatically click a link when the website loads
本文介绍了网站加载时如何自动单击链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图弄清楚在访问该网站时如何使锚点单击.如果有人可以帮助我,我将不胜感激,这是一个演示代码,您可以轻松匹配ID,谢谢.
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>
因此,我想知道任何JavaScript代码,以使页面加载时单击链接.预先谢谢你.
So i want to know any JavaScript code to make the link clicked when the page loads. Thank you in advance.
推荐答案
jquery答案:
$($('#deepakkamat').click());
这实际上会将click事件注册为原因,但似乎绝对没有必要.元方法是首选方法.
This will actually register a click event as the cause, but it seems awfully unnecessary. The meta method is the preferred method.
这篇关于网站加载时如何自动单击链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文