Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/475.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
Javascript 填充表时延迟事件_Javascript_Jquery - Fatal编程技术网

Javascript 填充表时延迟事件

Javascript 填充表时延迟事件,javascript,jquery,Javascript,Jquery,我正在创建一个简单的下拉插件,其中下拉列表的值是以表格的方式显示的 我想要的是在加载表时停止事件 这是我的密码 //appendTableForThePanel $('#appendHere').append('<table class="table table-hover table-condensed"></table>'); $('#appendHere').find('table').append('<thea

我正在创建一个简单的下拉插件,其中下拉列表的值是以表格的方式显示的

我想要的是在加载表时停止事件

这是我的密码

        //appendTableForThePanel
        $('#appendHere').append('<table class="table table-hover table-condensed"></table>');
        $('#appendHere').find('table').append('<thead></thead>');
        $('#appendHere').find('table').append('<tbody></tbody>');
        $('#appendHere').find('table').find('thead').append('<tr></tr>');


        for(appendCountHeader = 0; appendCountHeader < tableHeader.length; appendCountHeader++ ){

            $('#appendHere').find('table').find('thead').find('tr').append('<th>'+tableHeader[appendCountHeader]+'</th>');
        }

        //count tbody tbody_tr
        var tbody_tr = tbody.length / tableHeader.length;
        //count how many column / row 
        var tbody_td = tbody.length / tbody_tr;

        //append tbody tr tdcontent
        for(var i = 0; i < tbody.length; i += tbody_td) {
            $newRow = $("<tr>");
                for(var j = 0; j < tbody_td; j++) {
                   $newRow.append(
                       $("<td>").html(tbody[i + j])
                   );
                }

            $("#appendHere").find('table').find('tbody').append($newRow);
        }

        $('body').on('click', '#appendHere table tbody tr', function() {
            // alert($(this).find('td:nth-child(1)').html() + ' : ' + $(this).find('td:nth-child(2)').html());
            $($element.selector).val($(this).find('td:nth-child(2)').html());
            $('#appendHere').hide();
        });


       // **I want to deferred below functions when the table is appending**

        $($element.selector).blur(function(){
            setTimeout(function(){
                $('#appendHere').hide();
            }, 200);
        });

        $($element.selector).on('click',  function(){   
                $('#appendHere').show();
        });


        $($element.selector).keyup(function(){

        }); 
//appendTableForThePanel
$('#appendHere')。append('');
$(“#appendHere”).find('table').append(“”);
$(“#appendHere”).find('table').append(“”);
$('appendHere').find('table').find('thead').append('');
对于(appendCountHeader=0;appendCountHeader
我知道这是可能的,但我不能理解推迟一个函数的想法


提前谢谢。

请等待,直到加载表并追加行以声明函数。@bitfiddler是……这就是我想要的,先生。。