本文翻译自:jQuery hasAttr checking to see if there is an attribute on an element [duplicate]
Possible Duplicate: 可能重复:
Check existence of an attribute with JQuery 使用JQuery检查属性是否存在
How do you check if there is an attribute on an element in jQuery? 你如何检查jQuery中的元素是否有属性? Similar to hasClass
, but with attr
? 与hasClass
类似,但是attr
?
For example, 例如,
if ($(th