View Full Version : Clear input value on page load

10-02-2012, 02:10 AM
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.

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