jquery 1.6.2 issue using .prop() for checked and disabled
The ".prop()" method is all about setting/getting properties on DOM nodes, and not about setting attributes. As such, it doesn't add any attributes. What you're seeing is the behavior of the Firefox 5 "innerHTML" code, and not that of jQuery.
If you want to work with attributes of the HTML or XHTML (or whatever your DOM came from), use ".attr()". For most purposes in JavaScript working with the live DOM, however, you should use ".prop()".
你应该在这里使用attr
而不是prop
。
$("#test").attr({
checked: true,
disabled: true
});
链接地址: http://www.djcxy.com/p/27542.html