Removes all attributes and values from the object.
Syntax
object.clearAttributes()
Return Value
No return value.
Remarks
The clearAttributes method clears only persistent HTML attributes. The ID attribute, styles, and script-only properties are not affected.
Example
This example uses the clearAttributes method to remove user-defined attributes from an element.
<SCRIPT>
function fnClear(){
oSource.children[0].clearAttributes();
}
</SCRIPT>
<SPAN ID=oSource>
<DIV
ID="oDiv"
ATTRIBUTE1="true"
ATTRIBUTE2="true"
onclick="alert('click');"
onmouseover="this.style.color='#0000FF';"
onmouseout="this.style.color='#000000';"
>
This is a sample <b>DIV</b> element.
</DIV>
</SPAN>
<INPUT
TYPE="button"
VALUE="Clear Attributes"
onclick="fnClear()"
>
This feature requires Microsoft® Internet Explorer 5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.
Standards Information
There is no public standard that applies to this method.