attr()函数返回值为string。使用getAttribute()方法实现的。
prop()函数返回值为anything。尤其是适用在应该为boolean类型值的属性上。
For example, selectedIndex, tagName, nodeName, nodeType, ownerDocument, defaultChecked, and defaultSelected should be retrieved and set with the .prop() method.以上属性值应该使用prop()方法。
转载请注明原文地址: https://ju.6miu.com/read-26659.html