Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Need jquery to hide and show label

Posted on 2014-03-19
4
Medium Priority
?
348 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 total points
ID: 40145007
3 months later...

Check txtSqFT and lblSqFt are the correct case.
0

Featured Post

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

721 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