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

JQuery - How to Set Get Textbox Value using jQuery

Sep 2, 2012

Here I will explain how to get textbox value using jquery or how to set textbox value in jquery.

In previous post I explained
split the string using split function in jquery and many articles relating to JQuery. Now I will explain how to get or set textbox value in JQuery.

If we want to get textbox value in jquery or if we need to set value in textbox using jquery we need to write the code like as shown below

// Get textbox value
// Set textbox value
$('#txtName').val("your message")
If you want check this code in sample check below code


<html xmlns="">
<head id="Head1" runat="server">
<title>Get or Set textbox value in JQuery</title>
<script type="text/javascript" src=""></script>
<script type="text/javascript">
$(document).ready(function() {
$('#btnGet').click(function() {
//Get textbox value
$('#btnSet').click(function() {
// Set value in textbox
<form id="form1" runat="server">
<tr><td align="right" style=" font-family:Verdana; font-size:10pt"><b>UserName:</b></td>
<td> <input type="text" id="txtName" value="" /></td>
<tr><td><input type="button" id="btnGet" value="Get Text" /></td>
<td> <input type="button" id="btnSet" value="SET To 'Suresh'" /></td>

To check demo click on buttons and see the output

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


Kishor Karpe said...

hey thanks .....................

pratibha ts said...

if the textbox is in grid view than how to get text box value????....i mean i want display text box value in pop up using jquery..and my text box is in grid view......

SriRama Sai said...

Hi All,

If any asp control is dragged & dropped into asp TextBox, Source Code must display in TextBox using jquery. Pls help me.

Anonymous said...

how to validate textbox inside gridview using jquery

Girjesh Vishwakarma said...

i have to fetch the values from ASP textbox not html input type
plz rply

Anonymous said...

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.