hasAttribute method
Returns true when an attribute with a given name is specified on this element or has a default value, false otherwise.
hasAttribute(name )
Parameters
String name
The name of the attribute to look for.
Returns
trueboolean. if an attribute with the given name is specified on this element or has a default value, false otherwise.
這是否有幫助?