contentEditable property is used, it makes your text editable in the user’s browser (IE, Firefox, and Safari). The
contentEditable property has been around a while, but not a standard until recently under HTML5. It can be very fun and amusing to play with.
<div contenteditable="true">This text can be edited.
And this text can be edited.
Go ahead and play with it!</div>
Read More » »
We will be using the
innerHTML property. Each HTML element has an
innerHTML that defines the HTML code and text between the element’s tags. You must give the element you wish to update or change an id. Once it has an id we can use the
getElementById function to change only the elements we want with certain ids. Here is a basic example:
document.getElementById('colortext').innerHTML = 'red';
The apple is <span id='colortext'>green</span>.
<input type='button' onclick='updatetext()' value='Change Text'/>
The above results in: Read More » »