jquery .find()语法错误
任何人都可以发现导致结果不出现的错误吗?
如果我删除“FROM HERE”和“TO HERE”注释之间的代码,一切正常(好吧,它至少会出现在屏幕上)。 我很确定问题出在.find()语法上。
代码在$(document).ready上运行
$.ajax({ type: "POST", url: "ajax/ax_all_ajax_fns.php", data: 'request=index_list_contacts_for_client&user_id=' + user_id, success: function(data) { $('#contact_table').html(data); var tbl = $('#injected_table_of_contacts'); /* ************** FROM HERE *********************** */ tbl.find("div").each(function() { $(this).dialog({ autoOpen: false, height: 400, width: 600, modal: true, buttons: { Okay: function() { $( this ).dialog( "close" ); } }, { Cancel: function() { $( this ).dialog( "close" ); } }, close: function() { alert('DialogClose fired'); } }) }); /* ************** TO HERE *********************** */ } });
“ Cancel
按钮不正确。
buttons: { Okay: function() { $( this ).dialog( "close" ); }, // you have to put cancel here Cancel: function() {} }, // It should not be here //{ // Cancel: function() { // $( this ).dialog( "close" ); // } //},