Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.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
如何通过元素';s不发生的事件';jQuery中还不存在_Jquery - Fatal编程技术网

如何通过元素';s不发生的事件';jQuery中还不存在

如何通过元素';s不发生的事件';jQuery中还不存在,jquery,Jquery,当我点击#按钮时,firebug告诉我jQuery.js中有东西在运行。如何实现这样的功能?获取缺少的函数的第二个参数 // 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'); }); 此处的选择器未定

当我点击#按钮时,firebug告诉我jQuery.js中有东西在运行。如何实现这样的功能?

获取缺少的函数的第二个参数

// 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');
});

此处的选择器未定义且失败。

您需要将函数作为第二个参数传递给$('#text').live('focusout');没有回调参数,该行无论如何都没有任何功能

尝试以下方法:

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

您可以调用
$('#text').live('focusout',function(){/./})只要您愿意,就假定jQuery已加载。在点击按钮时调用它对我来说没有意义。即使使用第二个参数,它也不起任何作用,脚本太复杂了。。无论如何,谢谢D
$('#text').live('focusout', function(){
    //do logic here.
});