HTML DOM createAttribute()


This createAttribute() function makes a new attribute when you say what it should be called. You can use attribute.value to decide what's inside it. To put this new attribute in an element, you can use element.setAttribute() by telling it the attribute's name.

Syntax:

document.createAttribute( attributename )