jQuery技术:在动态生成的html数据表上应用jQuery Resizable

我需要你的帮助。

一旦生成,我似乎无法使用jQuery Resizable API来处理动态生成的数据表。 似乎函数在完成后调用它但是我得到一个错误“对象预期”

          #mstrWrapper { position: relative; height: 200px; width: 800px; border: 1px solid #808080; overflow-y: scroll; overflow-x: scroll; scrollbar-base-color: #DFDFDF; scrollbar-arrow-color: #235A81; } #mstrTable { width: 800px; color: #235A81; font-family: Arial; font-size: 9pt; border: 0px; } #mstrTable th, #mstrTable td { border-bottom: 1px solid #808080; border-right: 1px solid #808080; padding: 3px; } #mstrTable th { filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#ffffff", endColorstr="#cdcdcd"); width: 110px; height: 18px; border-bottom: 1px solid #808080; border-top: 0px; } #mstrTable tbody tr:first-child td { padding: 3px 3px 3px 3px; } #mstrTable tr.normal td { color: #235A81; background-color: white; } #mstrTable tr.highlighted td { color: #FFFFFF; background-color: #235A81; }   var table var tbody var ishigh function writeit() { var html = 'n' html +='n' html +=' n' html +='n' html +=' n' html +=' n' html +='n' html +=' n' html +=' n' html +='n' html +=' n' html +=' n' html +='
File Numbern' html +='Date1n' html +='Date2n' html +='Statusn' html +='Num.n' html +='n' html +='n' html +='
KABCn' html +='09/12/2002n' html +='09/12/2002n' html +='Submittedn' html +='0n' html +='n' html +='
KCBSn' html +='09/11/2002n' html +='09/11/2002n' html +='Lockdownn' html +='2n' html +='n' html +='
WFLAn' html +='09/11/2002n' html +='09/11/2002n' html +='Submittedn' html +='1n' html +='n' html +='
WPPPn' html +='03/19/2003n' html +='03/19/2003n' html +='In-Progressn' html +='0n' html +='n' html +='
WRRRn' html +='02/19/2002n' html +='02/19/2002n' html +='Submittedn' html +='5n' html +='n' html +='
WTTTn' html +='02/19/2002n' html +='02/19/2002n' html +='In-Progressn' html +='0n' html +='n' html +='
WYYDn' html +='02/11/2002n' html +='02/11/2002n' html +='Submittedn' html +='7n' html +='n' html +='
WRRRn' html +='02/19/2002n' html +='02/19/2002n' html +='Submittedn' html +='5n' html +='n' html +='n' html +='' document.getElementById('mstrWrapper').innerHTML = html $( "#mstrTable tr th" ).resizable({ handles: 'e' }); }

似乎代码在这一行上失败了,我没有看到任何错误,它应该工作:

 $( "#mstrTable tr th" ).resizable({ handles: 'e' }); 

    我真的不确定问题出在哪里,但这是一个解决方案: jsFiddle

    我建议你不要做的唯一事情就是:

      

    但是这样写:

     $("#load").on("click",writeit); 

      以上就是jQuery教程分享在动态生成的html数据表上应用jQuery Resizable相关内容,想了解更多jQuery开发(异常处理)及jQuery教程关注计算机技术网(www.ctvol.com)!)。

      本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

      ctvol管理联系方式QQ:251552304

      本文章地址:https://www.ctvol.com/jquerytutorial/532518.html

      (0)
      上一篇 2020年12月21日
      下一篇 2020年12月21日

      精彩推荐