aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

How to Clear Textbox Value with jQuery

Apr 30, 2013

Here I will explain How to use jQuery to clear textbox value or simple jQuery code snippet to clear textbox value using jQuery.


To clear all textbox values using jQuery we need to write the code like as shown below

$(function () {
$('#btnClear').click(function () {
$('input[type=text]').each(function () {
To clear Particular textbox using jQuery we need to write the code like as shown below

$(function () {
$('#btnClear').click(function () {
For complete example check below code

<html xmlns="">
<title>Clear Textbox using jQuery</title>
<script src="" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#btnClear').click(function () {
$('input[type=text]').each(function () {
$('#btnclr').click(function () {
<b>Enter Text:</b>
<input type="text" id="txtuser" />
<input type="text" id="txtName" />
<input type="button" id="btnclr" value="Clear First Textbox" />
<input type="button" id="btnClear" value="Clear All Textboxes" />
Live Demo

To check live demo try to enter text in below textboxes and click on buttons

Enter Text:

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


jaan09 said...

nice training said...

nice blog for readers.

Anonymous said...

Sir, How to print the content of div using javascript? pls help me

Ankit Kumar said...

sorry but my code is not working

Give your Valuable Comments

Other Related Posts

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.