大佬教程收集整理的这篇文章主要介绍了如何添加jQuery .on点击进入Tablesorter?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
jQuery脚本:
$('#table-content').on( 'click','.tablesorter thead tr th',function() {alert(); } );
我的HTML:
<div id="table-content"> <table class="tablesorter"> <thead> <tr> <th class="header">No.</th> <th class="header">Name</th> <th class="header">Phone</th> </tr> </thead> </table> </div>
结果:当我单击表格上的标题时,没有警报弹出窗口.
>只更新tbody中的行,除非标题单元格被完全替换,否则您不必担心处理标题点击.
如果将表存储为完整表,则按照其他选项(建议#2),或将表加载到临时持有者中,然后传输tbody并更新表.
var $table = $('#table-content').find('table'); $('#hidden-div').load( "ajax.html",function() { // remove old tbody $table.find('tbody').remove(); // move new tbody into the initialized tablesorter table $('#hidden-div').find('table tbody').appendTo( $table ); // update tablesorter's cache $table.trigger('update'); });
>如果要替换整个表,只需重新初始化tablesorter.你的ajax看起来像这样:
var options = { /* add tablesorter options here */ }; $.ajax({ url: url,data: data,success: function(data){ $('#table-content').find('table').tablesorter(options); },dataType: dataType });
以上是大佬教程为你收集整理的如何添加jQuery .on点击进入Tablesorter?全部内容,希望文章能够帮你解决如何添加jQuery .on点击进入Tablesorter?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。