HTML and CSS Reference
In-Depth Information
var
stopEditBtn
=
docu-
ment.getElementById('stopEditBtn');
var
clearBtn
=
docu-
ment.getElementById('clearBtn');
startEditBtn.onmousedown = startEdit;
stopEditBtn.onmousedown = stopEdit;
clearBtn.onmousedown = clear;
// update text with data in local storage
if
(localStorage.getItem("savedtext"))
edit-
able.innerHTML =
localStorage.getItem("savedtext");
}
function startEdit()
{
// add the contenteditable attribute
editable.setAttribute("contenteditable",
true);
}
function stopEdit()
{
// disable the contenteditable attribute
editable.setAttribute("contenteditable",
false);
// save the text
localStorage.setItem("savedtext",
edit-
able.innerHTML);
}
function clear()
{
// clear the local storage
localStorage.clear();
Search WWH ::




Custom Search