Sunday, January 27, 2013

Facebook like Expanding Textbox with Jquery in asp.net

In the previous posts showed
In this post i will show how to expand textbox when focus and collapse when leave as shown below....

Script :



<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="ExpandTextBox_Focus._Default" %>
 
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">    
    <script src="Scripts/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    function Expand() {
        $('#txtExpand').animate({ "height""85px" }, "slow");
        //$("#txtExpand").slideDown("slow");
    }
 
    function Colapse() {
        $("#txtExpand").animate({ "height""30px" }, "slow");
        //$("#txtExpand").slideUp("slow");
    }
</script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <table style="width100%;">
        <tr>
            <td>
               Expand TextBox when focus like faceBook
            </td>
        </tr>
        <tr>
            <td>
             <textarea id="txtExpand" style="width:450pxheight:30pxborder:solid 2px #006699font-size:14px;"
              onfocus="Expand()"
              onblur="Colapse()" ></textarea>
            </td>
        </tr>
    </table>
</asp:Content>

No comments:

Post a Comment