Reputation: 199
<input name="input15" type="text" size="50" onblur="var input15 = document.getElementById("input15"); input.value == """/>
Anyone know why the input field isn't getting cleared when I click out of the input box?
I'll type the name "Bob" into the input field then when I click on the blank white space outside the field, the field does not get cleared.
Upvotes: 1
Views: 4017
Reputation: 56501
Try the below code.
<html>
<head>
<script type="text/javascript">
function clearText(){
document.getElementById("input15").value = "";
}
</script>
</head>
<body>
<input id="input15" type="text" size="50" onblur="clearText()" />
</body>
</html>
Upvotes: 0
Reputation: 388316
Try
<input name="input15" type="text" size="50" onblur="this.value=''"/>
Demo: Fiddle
Upvotes: 5
Reputation: 421
the name of your var is input15, and then after the semi colon you use input.value rather than input15.value? Also you have the == instead of assignment...
Upvotes: 0