单击另一个单击事件中的锚标记?
Click an anchor tag inside another click event?
有没有办法在另一个事件中单击锚标记。我这里的东西似乎不起作用:
jsfiddle: http://jsfiddle.net/my7oxtL0/1/
JS:
$('.mybutton').click(function(){
//other stuff runs
$("#link1").click();
});
html:
<button class="mybutton">click me</button>
<a id="link1" href="http://www.google.com" target="_blank"></a>
试试这个,
$('.mybutton').click(function(){
//other stuff runs
document.getElementById("link1").click();
});
让我知道您为什么尝试点击此处的锚标记?您可以尝试使用 window.open() 方法来执行
Window.open($("#anchor").attr('href'));
有没有办法在另一个事件中单击锚标记。我这里的东西似乎不起作用:
jsfiddle: http://jsfiddle.net/my7oxtL0/1/
JS:
$('.mybutton').click(function(){
//other stuff runs
$("#link1").click();
});
html:
<button class="mybutton">click me</button>
<a id="link1" href="http://www.google.com" target="_blank"></a>
试试这个,
$('.mybutton').click(function(){
//other stuff runs
document.getElementById("link1").click();
});
让我知道您为什么尝试点击此处的锚标记?您可以尝试使用 window.open() 方法来执行
Window.open($("#anchor").attr('href'));