Solved

Need jquery to hide and show label

Posted on 2014-03-19
4
334 Views
Last Modified: 2014-06-19
I Have a label called lblMyErr and by default is hidden.  I have a gridview called mygrid and a template textbox called txtSQFT.   What I need is a jquery function I can use on the txtSQFT
textbox, so that if the textbox has been changed it will run this jquery function and make visible the lblmyerr.

The issue is I have a gridview control that is edit mode for all rows.  So I cant use row updating or something like that.  I need a jquery to run on the textbox textchanged event.

thanks

 
<asp:TemplateField HeaderText="Sq Ft" HeaderStyle-HorizontalAlign="Left">
                            <ItemTemplate>
                                <asp:Label ID="lblSqFt" runat="server" Text='<%# Bind("SqFt") %>'></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="txtSqFT" runat="server" Text='<%# Bind("SqFt") %>' OnTextChanged="sqft_TextChanged"></asp:TextBox>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Numbers Only"
                                    Text="*" ValidationExpression="^(?:\d+(?:\.\d{1,2})?)?$" ControlToValidate="txtsqft"></asp:RegularExpressionValidator>
                            </EditItemTemplate>
                            
                        </asp:TemplateField>

Open in new window

0
Comment
Question by:mgmhicks
  • 2
4 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 39940749
<script>
$(function() {
     $("#<%=txtSqFT.ClientID%>").change(function(){
          $("#<%=lblSqFt.ClientID%>").show()
     })
})
</script>

Open in new window

0
 

Author Comment

by:mgmhicks
ID: 39942454
thanks Gary, I'm getting txtsqft does not exist.  I am using a master page if that changes the script at all.
0
 
LVL 4

Expert Comment

by:smeghammer
ID: 40144986
Javascript is case sensitive:

txtSqFT != txtsqft...

Cheers
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40145007
3 months later...

Check txtSqFT and lblSqFt are the correct case.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need help parsing JSON in my VB.Net application 4 47
jQuery Syntax 2 47
How to use odbc in vb to connect to ms sql 14 38
VS.net 2010 11 26
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now