Clear textbox value using jQuery
clear all textbox,radio button, check box value using jQuery
Clear all textboxes client side
$('input[type=text]').val('');
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>clear textbox value using jQuery</title> <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.0.js"></script> </head> <body> <input name="textbox" type="text" /> <input name="hiddenfield" type="hidden" value="testhidden" /> <textarea name="textarea" cols="" rows=""></textarea> <input name="chk" type="checkbox" value="" /> <input name="radiobutton" type="radio" value="" /> <input name="" id="reset" type="submit" value="Clear" /> <script type="text/javascript"> $(function () { $("#reset").click(function () { $("input,textarea").not(':reset, :submit, :hidden, :button, :checkbox,:radio').val(""); $('input:checkbox,input:radio').removeAttr('checked'); $('input[type=text]').focus(); return false; }); }); </script> </body> </html>
Clear textbox value using jQuery
Reviewed by Bhaumik Patel
on
7:47 PM
Rating: