JavaScript Reference/Javascript Methods/removeAttribute
"removeAttribute()" Example
<html>
<body>
<script language="JavaScript">
function function1(){
var m = document.getElementById("myDiv").removeAttribute("id");
document.all.myB.innerText = "Click again";
if (m == true) {
alert("Attribute removed");
}
}
</script>
<div id="myDiv">This is a div element</div>
<input id="myB" type="button" value="Remove id attribute" onclick="function1();">
</body>
</html>
"removeAttribute()" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<a> <acronym> |
| |<address> <applet> |
| |<area> <b> |
| |<base> <basefont> |
| |<bdo> <bgsound> |
| |<big> <blockquote> |
| |<body> <br> |
| |<button> <caption> |
| |<center> <cite> |
| |<code> <col> |
| |<colgroup> <comment> |
| |<custom> <dd> |
| |<del> <dfn> |
| |<dir> <div> |
| |<dl> <dt> |
| |<em> <embed> |
| |<fieldset> <font> |
| |<form> <frame> |
| |<frameset> <head> |
| |<hn> <hr> |
| |<html> <i> |
| |<iframe> <img> |
| |<input> <input type="button"> |
| |<input type="checkbox"> <input type="file"> |
| |<input type="hidden"> <input type="image"> |
| |<input type="password"> <input type="radio"> |
| |<input type="reset"> <input type="submit"> |
| |<input type="text"> <ins> |
| |<isindex> <kbd> |
| |<label> <legend> |
| |<li> <link> |
| |<listing> <map> |
| |<marquee> <menu> |
| |<meta> <nobr> |
| |<noframes> <noscript> |
| |<object> <ol> |
| |<optgroup> <option> |
| |<p> <param> |
| |<plaintext> <pre> |
| |<q> runtimeStyle |
| |<s> <samp> |
| |<script> <select> |
| |<small> <span> |
| |<strike> <strong> |
| |style <sub> |
| |<sup> <table> |
| |<tbody> <td> |
| |<textarea> <tfoot> |
| |<th> <thead> |
| |<title> <tr> |
| |<tt> <u> |
| |<ul> <var> |
| |<wbr> <xmp> |
+----------------+--------------------------------------------------------------+
"removeAttribute()" Syntax, Parameters and Note
Note:
Removes the specified attribute value from the element.
Returns true (successful) or false (failed).
Syntax:
document.getElementById("elementID").removeAttribute(param1, param2)
document.all.elementID.removeAttribute(param1, param2) // IE only
Parameters:
param1 Required; the name of the attribute.
param2 Optional; the type of search.
1 the default for a case-sensitive search
any other value for a non?case-sensitive search.