Click here to Skip to main content
15,922,574 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a UI with text area with only 2 rows & 10 cols.
On clicking/focus,the text area should be expanded.

The text areas only inside repeaters must be expanded, not others.

Thanks in Advance!
Posted
Updated 17-Mar-15 1:25am
v2
Comments
What have you tried and where is the issue?
Sergey Alexandrovich Kryukov 17-Mar-15 7:26am    
Add an event handler to the onclick event and modify some attributes in the handler.
What have you tried so far?
—SA
Reshma Babu 18-Mar-15 4:37am    
I had tried with JQuery. But I needed the solution in CSS.
I got it. Thnx :)

XML
<asp:TextBox ID="txtUserName" onfocus="changesize(this);" runat="server" CssClass="txtwidth200" MaxLength="50"
                                    TabIndex="1" TextMode="MultiLine" placeholder="Username"></asp:TextBox>

<pre lang="cs">function changesize(obj) {
            $(obj).attr(&#39;style&#39;, &#39;width:250px; Height:200px;&#39;);
        }</pre>



Similiar way on focus out you could shrink back the textbox
 
Share this answer
 
This code does the trick..
CSS
textarea:focus{
        width: 250px;
        position:absolute;
        font-size:15px;
        height:100px;
        background-color: #E7FBF8;
        outline: none;
        -moz-box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
        -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
        box-shadow: inset inset 0 0 5px rgba(0,0,0,0.5);
        }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900