Javascript examples for DOM:Attribute
The removeNamedItem() method removes the node by name in a NamedNodeMap object.
Parameter | Type | Description |
---|---|---|
nodename | String | Required. The name of the node in the namedNodeMap |
A Node object, representing the removed attribute node
The following code shows how to Remove the type attribute from an input button:
<!DOCTYPE html> <html> <body> <input type="button" value="OK"> <button onclick="myFunction()">Test</button> <script> function myFunction() {//from w w w. ja v a 2 s.co m var btn = document.getElementsByTagName("INPUT")[0]; btn.attributes.removeNamedItem("type"); } </script> </body> </html>