![]() |
VOOZH | about |
This createAttribute() method is used to create an attribute with the specified name and returns the attribute object. The attribute.value property is used to set the value of the attribute and the element.setAttribute() method is used to create a new attribute for an element. This method() contains the name of the created attribute as a parameter value.
Syntax:
document.createAttribute( attributename )Example: In this example, we will use the createAttribute() method.
Output:
👁 ImageExample 2: In this example, we will use the createAttribute() method.
Output:
👁 ImageSupported Browsers: The browser supported by DOM createAttribute() method are listed below: