jQuery学习之prop和attr的区别

2025-04-13 09:56:47
推荐回答(1个)
回答(1):

.prop()
方法应该被用来处理boolean
attributes/properties以及在html(比如:window.location)中不存在的properties。其他所有的
attributes(在html中你看到的那些)可以而且应该继续使用.attr()方法来进行操作。

参考网址: http://www.suicai8.com/detail/117.html