Javascript Reference
Categories: Element

javascript Element removeAttribute( )

@March 15, 2008, 1:22 a.m.
removeAttribute( )Firefox/Netscape/NN 6 IE 4 Chrome/Safari/DOM 1  

removeAttribute("attributeName") removeAttribute("attributeName"[, caseSensitivity])

  

Removes the named attribute from the current element. An IE 4 requirement that limited attribute removal to attributes that had been added with the setAttribute( ) method is not applicable in IE 5 and later or Netscape 6. Removing an attribute does not change the source code when viewed through the browser, but does affect how the browser renders the element. The attribute value or node is also no longer available after removal.

 
Parameters
 
  • The (case-insensitive by default) attribute name used in the HTML tag (not including the = symbol). While IE lets you switch between case-sensitivity settings, Netscape 6 does not demand case-sensitivity. But given the trend toward case-sensitive XHTML, it is best to get into the case-sensitive habit.
  • An optional integer value for IE only. Default value is 0 (not case-sensitive). If 1, the attribute in the HTML tag must match the case of the attributeName parameter exactly for its value to be returned.
 
Returned Value

In IE, Boolean true if successful; false if the attribute doesn't exist. No returned value in Netscape 6 (or W3C DOM specification).


Powered by Linode.