HTML5 APPLICATIONS DEVELOPMENT MANUAL

(lu) #1

26 - Changing, Adding and Deleting


Elements


Updating Content in Elements


Use the innerHTML property to change content or insert new


content between element tags. It can be used on any element. To change


content, set the innerHTML property to the desired string. To do this, we


must use the equals symbol (=). To remove content, set it to an empty string.


element.innerHTML = new
html content

Change the inner
HTML of an element

element.attribute = new value

Change the attribute
value of an HTML
element

element.setAttribute(attribute,
value)

Change the attribute
value of an HTML
element
element.style.property = new
style

Change the style of
an HTML element

<!DOCTYPE html>







Click me




Free download pdf