I have managed to change the text value of the input field onfocus to nothing, but I can't work out how to get it to change back on the onclick of anywhere else on the webpage HTML:
<input type="text" value="this is value" id="text">
JS:
document.getElementById("text").onfocus = function() {
var value = "on"
if (value==="on") {
document.getElementById("text").value=""
value="off"
} else {
document.getElementById("text").value="this is value"
value="on"
}
window.onclick = function() {
document.getElementById("text").value="this is value"
}
}