Modifying Element Attributes
Learn how to add, remove, and view element attributes using JavaScript.
Element.getAttributeNames()
Use the Element.getAttributeNames() function to get an array containing the names of the HTML element’s attributes.
Element.getAttribute(name)
You can access the value of a specific attribute within an HTML element using Element.getAttribute() passing the attribute’s name as a string argument.
Element.setAttribute(name, value) + Element.removeAttribute(name)
You can change the value of an attribute using the setAttribute() function. Additionally, you can remove attributes using the removeAttribute() function.
Exercise
Modify the following ordered list programmatically to use big Roman numerals for the list items.