在动态生成的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 +='File Number\n' html +=' Date1\n' html +=' Date2\n' html +=' Status\n' html +=' Num.\n' html +='\n' html +='\n' html +=' \n' html +=' \n' html +='KABC\n' html +=' 09\/12\/2002\n' html +=' 09\/12\/2002\n' html +=' Submitted\n' html +=' 0\n' html +='\n' html +=' \n' html +='KCBS\n' html +=' 09\/11\/2002\n' html +=' 09\/11\/2002\n' html +=' Lockdown\n' html +=' 2\n' html +='\n' html +=' \n' html +='WFLA\n' html +=' 09\/11\/2002\n' html +=' 09\/11\/2002\n' html +=' Submitted\n' html +=' 1\n' html +='\n' html +=' \n' html +='WPPP\n' html +=' 03\/19\/2003\n' html +=' 03\/19\/2003\n' html +=' In-Progress\n' html +=' 0\n' html +='\n' html +=' \n' html +='WRRR\n' html +=' 02\/19\/2002\n' html +=' 02\/19\/2002\n' html +=' Submitted\n' html +=' 5\n' html +='\n' html +=' \n' html +='WTTT\n' html +=' 02\/19\/2002\n' html +=' 02\/19\/2002\n' html +=' In-Progress\n' html +=' 0\n' html +='\n' html +=' \n' html +='WYYD\n' html +=' 02\/11\/2002\n' html +=' 02\/11\/2002\n' html +=' Submitted\n' html +=' 7\n' html +='\n' html +=' \n' html +='WRRR\n' html +=' 02\/19\/2002\n' html +=' 02\/19\/2002\n' html +=' Submitted\n' html +=' 5\n' 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 ajax请求中获取返回数据?
- 尝试动态加载API和JS文件
- 谷歌地图v3 API + jQuery冲突?
- 如何通过AJAX / jQuery进行OAuth身份validation?
- 使用Youtube的javascript API和jQuery
- 如何在jQuery mobile(1.4 beta)中更改页面?
- 使用jQuery的Youtube iframe播放器JS API – 播放器对象没有方法’getPlayerState’
- 使用GitHub API V3从组织获取私人回购
- 在youtube api中检测播放事件
Interesting Posts
如何通过添加for循环来重写搜索function以通过data.games并在我搜索时添加它来说明分数?
Soundcloud身份validation/连接javascript问题
如何在客户端Javascript中隐藏API密钥
点击使用YOUTUBE Iframe加载多个video
Facebook Connect,jQuery UI和jQuery.noConflict()
如何将JQuery变量传递给全局变量
Slick-carousel如何通过youtube api打开video时停止自动播放
我想从JSON数据数组中获取一个特定的条目并进行一些修改
html5的文件api与jquery的例子?
Mailchimp API获取错误,无法使用ajax成功