Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

element.hasAttributes

Summary

hasAttributes returns a boolean value of true or false, indicating if the current element has any attributes or not.

Syntax

result = targetNode.hasAttributes();

Examples

var t1 = document.getElementById("table-data"); 

if ( t1.hasAttributes() ) { 
  // do something with 
  // t1.attributes
}

Specification

See also

Document Tags and Contributors

 Last updated by: ethertank,