gpt4 book ai didi

jquery - 如何通过 jQuery 中尚不存在的元素事件使元素 live()

转载 作者:行者123 更新时间:2023-12-01 01:28:10 25 4
gpt4 key购买 nike

// for example
$('#text').die('focusout');

//then I try to make it live() with a button that just exist
$('#button').live('click', function(){
$('#text').live('focusout');
});

当我点击 #button 时,firebug 告诉我 jQuery.js 中有些东西已经磨损了。如何完成这样的事情?

最佳答案

live接受您缺少的函数的第二个参数

function liveConvert( type, selector ) {
return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspaces, "&");
}

这里选择器未定义并且失败。

关于jquery - 如何通过 jQuery 中尚不存在的元素事件使元素 live(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7693102/

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