On Nov 15, 2006, at 11:45 AM, Glen Lipka wrote:

When I did this:
$("#someInput").val(""); 
it made it null in FF but in IE it left it alone.

How do I use val() to erase the current value?

Hi Glen,

I just tested this on my server, and it worked on both IE and FF.

HTML:
<form>
    <input type="text" name="tester" value="" id="tester" /><br />
    <textarea id="foo" rows="8" cols="40"></textarea>

  <p><input id="form_submit" type="submit" value="empty val" /></p>
</form>


JQUERY:
$(document).ready(function(){
  $('#form_submit').click(function() {
    $('#tester').val('');
    $('#foo').val('');
    return false;
  });
});

Also, Mike Alsup mentioned in another thread that those two val() lines could be done like this instead:
    $('#tester')[0].value = "";
    $('#foo')[0].value = "";

That worked for me, too.

Karl
___________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to