gpt4 book ai didi

javascript - livequery 停止工作

转载 作者:行者123 更新时间:2023-11-30 06:47:38 26 4
gpt4 key购买 nike

$j(".context-menu").livequery(function(){
alert('found');
});

这在几天前一直有效。它突然停止了。添加具有“上下文菜单”类的新元素时,没有任何反应。

虽然在 firebug 中,如果我运行上面的语句,它会被发现并引发警报。

知道问题出在哪里吗?

HTML:

<html>
<head>
<script type='text/javascript' src='/scripts/prototype.js'></script>
<script type='text/javascript' src='/scripts/jquery-1.4.2.js'></script>
<script type='text/javascript'>
var $j = jQuery.noConflict();
</script>
<script type='text/javascript' src='/scripts/jquery.livequery.js'></script>
</head>
<body>
<div class='fun'>fun</div>
</body>

最佳答案

我创建了这个简单的片段来测试 livequery 是否适用于当前的 jQuery 并且它没有问题(这里是 jsfidde http://jsfiddle.net/x3tds/1/ ):

<a href="javascript:void(0)" onclick="adddiv('')">Click me</a>


<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>

<script src="http://brandonaaron.net/javascripts/plugins/livequery.js"></script>


<script>

jQuery("div").livequery(function() { alert("div added") })

function adddiv()
{
jQuery("a").append("<div>Hello</div>")
}
</script>

关于javascript - livequery 停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4836118/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com