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是……这就是我想要的,先生。。