dojo/dom-attr

Project owner:Eugene Lazutkin
since:V1.7

This module defines the core Dojo DOM attributes API. The standard return variable for this module is domAttr.

Features

AMD Features

  • domAttr.has

    Returns true if the requested attribute is specified on the given element, and false otherwise.

  • domAttr.get

    Gets an attribute on an HTML element.

  • domAttr.set

    Sets an attribute on an HTML element.

  • domAttr.remove

    Removes an attribute from an HTML element.

  • domAttr.getNodeProp

    Returns an effective value of a property or an attribute.

Legacy features are set in dojo/_base/html.

Examples

require(["dojo/dom-attr"], function(domAttr){
  if domAttr.has("nodeId", "foo"){
    console.log("nodeId has attribute foo = " + domAttr.get("nodeId", "foo"));
  }else{
    console.log("nodeId doesn't have attribute foo");
  }
});

See also

API Reference: dojo.dom-attr

Error in the documentation? Can’t find what you are looking for? Let us know!