可能重复: 使用JQuery检查属性是否存在
你如何检查jQuery中的元素是否有属性?类似于hasClass,但有attr?
hasClass
attr
例如,
if ($(this).hasAttr("name")) { // ... }
jquery
jquery ×1