The insertAttribute() method adds a attribute to a element
insertAttribute()
Example
document.querySelector("body").insertAttribute("id","id 1")
Last updated 2 months ago