...

View Full Version : Clear input value on page load



howie2009
10-02-2012, 02:10 AM
Hi,
I was hoping someone could help. I need to clear a text input value when my page loads. any idea how I could do this with js or jquery? I need to set it to blank as oppose to reset it. It can clear all inputs if its easier. thanks guys!:)

Old Pedant
10-02-2012, 02:30 AM
??? So then why give it a non-blank value in the first place?

But yes, trivial.


<html>
<body>
<form id="theForm" ...>
<input name="whatever" value="banana pudding" />
...
</form>
<script type="text/javascript">
(
function( )
{
var form = document.getElementById("theForm");
form.whatever.value = "";
}
)( );
</script>
</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum