TOC PREV NEXT INDEX

Put your logo here!


hasAttributeNS


hasAttribute is a boolean value indicating whether the current element has an attribute with the specified name and namespace.

Syntax

[ true | false ] = element.hasAttribute(namespace, localName) 

Parameters

boolean true | false

namespace is a string representing the namespace you are looking for

localName 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.hasAttributeNS( 
  "http://www.mozilla.org/ns/specialspace/",  
  "special-align") { d.setAttribute("align", "center"); } 

Notes

None.

Specification

core


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