一个表单,属性是disabled
<input type="text" disabled/>u200b
我希望点击该表单后,disabled变为可编辑,用了下面的代码
$(':input').click(function () { $(this).removeAttr('disabled');})
可是发现怎么点击都不行,求指导。测试地址 http://jsfiddle.net/6cm9r/
解决方案
$(document).click(function(e){ var el = e.target; if (el.tagName == 'INPUT') { $(el).removeAttr('disabled'); }})