Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/395.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在锚定标记中找到锚定链接,并使用jquery自动单击该链接_Javascript_Jquery - Fatal编程技术网

Javascript 如何在锚定标记中找到锚定链接,并使用jquery自动单击该链接

Javascript 如何在锚定标记中找到锚定链接,并使用jquery自动单击该链接,javascript,jquery,Javascript,Jquery,如何在锚定标记中找到锚定链接,并在jquery中自动单击该链接 范例 <div id="myid"> <a id="interestingness" href="htttp://mylink.com">mytestinglink</a> </div> 您可以尝试以下方法: $('#interestingness')[0].click(); $(“#趣味性”)。单击()在所有兼容HTML5的浏览器上,您只需使用:趣味性。单击() <div

如何在锚定标记中找到锚定链接,并在jquery中自动单击该链接

范例

<div id="myid">
<a id="interestingness" href="htttp://mylink.com">mytestinglink</a>
</div>

您可以尝试以下方法:

$('#interestingness')[0].click();

$(“#趣味性”)。单击()

在所有兼容HTML5的浏览器上,您只需使用:
趣味性。单击()
<div id="myid">
<a id="interestingness" href="htttp://mylink.com" target="_blank">mytestinglink</a>
</div>
$("#interestingness").click(function(){
          var currentAnchor = $(this);
          alert(currentAnchor.text());
          alert(currentAnchor.attr('href'));
        });