jQuery内部函数不起作用

阿克
setTimeout( myFunction, 1000 );
function myFunction() {
$('#content').delegate('#fileList', 'fileActionsReady',function(ev){
                var $fileList = ev.fileList.$fileList;
                $fileList.find('tr').each(function(){
                    $filename = $(this).attr('data-file');
                    $owner = $(this).attr('data-share-owner');  
                    $id = $(this).attr('data-id');
                    getState($id,$filename,$owner,"true");
  setTimeout( myFunction, 5000 );
}

如您所见,我正在尝试循环一个在页面中列出特定表的函数,然后它调用另一个函数来更新信息。现在我在函数外部使用此代码没有任何问题,但是当我将其放在函数内部时,它将停止工作。我是javascript的新手,因此经过数小时的搜索后我仍然没有发现问题所在。

davcs86
function myFunction() {
        $('#fileList tr').each(function(){
            $filename = $(this).attr('data-file');
            $owner = $(this).attr('data-share-owner');  
            $id = $(this).attr('data-id');
            getState($id,$filename,$owner,"true");
        });
        setTimeout( myFunction, 5000 );
}
setTimeout( myFunction, 1000 );

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章