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 expand textbox on focus using

Aug 19, 2012

Here I will explain how to expand or increase textbox size on focus using JQuery in

In previous article I explained disable right click on image using JQuery and many articles relating to JQuery. Now I will explain how to expand or increase textbox size on focus using JQuery in

To implement this one we need to write code as shown below in your aspx page

<html xmlns="">
<title>jquery expand textbox on focus using</title>
<script type="text/javascript" src="">
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$('#txtUserName').focus(function() {
width: 250,
$('#txtUserName').blur(function() {
width: 150,

<form id="form1" runat="server">
<asp:TextBox ID="txtUserName" runat="server" />
If you observe above code in header section I added script file link by using that file we have a chance to interact with JQuery and in header script we have focus and blur events for txtUserName textbox which is used to animate the texbox to increase or decrease size based on onfocus and onblur. 


To test this sample check below textbox


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


Harman Kumar said...

nice post...:)

Anonymous said...

Hi Suresh,

Nice post, working fine.. I need your help, How can use this on grid view item templates?

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.