<script>
function clear() {
document.getElementById('box').value = " ";
};
</script>
<input type="text" id="box" onFocus="clear()" value="Type name here">
Hi, so i'm fairly new to javascript and I'm trying to clear a text field onFocus. I have searched the site and found other ways to do this, but i was curious as to why this code wouldn't work. Would appreciate any help, thanks :)