dojo.removeAttr

Available:since V1.2

Removes an attribute.

Introduction

dojo.removeAttr() removes an attribute. It is modeled after DOM’s removeAttribute, but unlike the latter it normalizes standard attribute names to smooth over differences between browsers, or to provide convenient aliases, e.g., className is aliased to class, and so on. The same algorithm is used by dojo.attr.

Usage

1
dojo.removeAttr(node, attr);
node
id or reference of the DOM node to get/set style for
attr
the attribute property name.

Examples

Removing an attribute

The following example will remove disabled from the input node.

<script type="text/javascript">
  function remAttr(){
    dojo.removeAttr("model", "disabled");
  }
</script>
<p><input id="model" name="model" disabled="disabled" value="some text"> &mdash; our model node</p>
<p><button onclick="remAttr();">Remove "disabled"</button></p>
Error in the documentation? Can’t find what you are looking for? Let us know!