使用jQuery单击链接时遇到麻烦 [英] Having trouble using jquery to click on a link
问题描述
我只是想单击带有jquery的链接.这是我的代码.当我手动单击该链接时,它可以工作,因此我知道该链接是好的.
I'm just trying to click on a link with jquery. Here's my code. When I click on the link manually it works, so I know the link is good.
$(this).find("td:first > * > a").click();
我得到的错误是未捕获的RangeError:超出了最大调用堆栈大小
The error I get is Uncaught RangeError: Maximum call stack size exceeded
我可以将代码更改为
$(this).find("td:first > * > a").css('background-color', "red");
,它将链接背景颜色更改为红色,因此我知道我已经成功选择了锚点.我做了很多研究,发现其他一些链接上的click()
功能有问题.
and it changes the link background color to red so I know I've successfully selected the anchor. I've researched a lot and found some others having issues with the click()
function on links.
这是我尝试做的一个非常简单的jsfiddle,我无法使其正常工作. jsfiddle.net/vtLq9/10当我单击按钮时,我希望链接被单击并带到href.谢谢.
Here is a very simple jsfiddle of what I'm trying to do and I can't get it to work. jsfiddle.net/vtLq9/10 When I click the button I want the link to be clicked and be taken to href. Thanks.
感谢您的帮助.
戴尔
推荐答案
Uncaught RangeError: Maximum call stack size exceeded
.通常,这意味着您正在调用一个可以自行调用的函数,可能是通过另一个函数.
Uncaught RangeError: Maximum call stack size exceeded
occurs when your call stack is too deep. This usually means you're calling a function that keeps call itself, possibly via another function.
页面上必须有与此脚本进行交互的其他内容.您的点击处理程序是否有机会执行点击处理? ;)
There must be something else on the page that is interacting with this script. Does your click handler execute the click handle by any chance? ;)
这篇关于使用jQuery单击链接时遇到麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!