【发布时间】:2015-03-13 09:21:50
【问题描述】:
我收到了这样的td:
<td id='mytd' style="cursor: pointer" onclick="editLoadInfo(this)">
然后在 js 中,我通过以下方式禁用它:
$("#mytd").removeAttr('onclick');
然后我通过以下方式启用它:
$("#mytd").attr('onclick', 'editLoadInfo(this)');
但是,当我添加attr 时,jquery 不理解this。怎么能这样?
任何解决方案将不胜感激。
谢谢。
【问题讨论】:
-
试试 $("#mytd").attr('onclick', 'editLoadInfo('+$("#mytd")+')');
标签: javascript jquery html bind attr