在我以前版本的应用程序中,这段代码工作得很好:
form.find('input').disable();对于新的环境(Rails 3.3和新版本的JQuery),这不再有效。
我得到的错误是:
未公开的TypeError对象对象没有方法“禁用”。
为什么我要得到这个错误,以及如何解决它?
发布于 2012-04-19 14:49:49
[].forEach.call( form.elements, function ( el ) { el.disabled = true } )或者在jQuery .
$(document.forms['form_name'].elements).each(function() {
this.disabled = true;
});发布于 2012-04-19 14:38:44
不要使用disable(),而是使用prop("disabled", true)。
据我所知,在disable()中从来没有jQuery方法
https://stackoverflow.com/questions/10230451
复制相似问题