TOC PREV NEXT INDEX

Put your logo here!


hasAttribute


hasAttribute is a boolean value indicating whether the current element has the specified attribute or not.

Syntax

[ true | false ] = element.hasAttribute(attName) 

Parameters

boolean true | false

attName is a string representing the name of the attribute

Example

// check that the attirbute exists 
// before you set a value 
d = document.getElementById("div1"); 
if d.hasAttribute("align") { 
  d.setAttribute("align", "center"); 
} 

Notes

None.

Specification

core


mozilla.org | mailto:oeschger | bug 93108
TOC PREV NEXT INDEX