Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Hide show validation message

Posted on 2012-04-10
7
Medium Priority
?
339 Views
Last Modified: 2012-06-27
How can I hide and show the validation message below?
There are going to be several elements in the form.

<label for="txtBillingFirstName">First Name:<span class="required">*<strong style="display:inline" class="validate">First Name is required</strong></span></label><input type="text" id="txtBillingFirstName" maxlength="15" />
0
Comment
Question by:JRockFL
[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
7 Comments
 
LVL 12

Assisted Solution

by:Anuradha Goli
Anuradha Goli earned 400 total points
ID: 37827318
place all the elements in div tag
change the display property to block /none to show /hide div tag.
<div id="divcontent">...................</div>

document.getelementbyid("divcontent").display ="block"
0
 
LVL 82

Expert Comment

by:leakim971
ID: 37827365
you may use :
        $("label[for='" + $(this).attr("id") + "']").show();

Open in new window

and :
        $("label[for='" + $(this).attr("id") + "']").hide();

Open in new window

check this page : http://jsfiddle.net/hJXug/
0
 
LVL 8

Author Comment

by:JRockFL
ID: 37827388
leakim971,
I'm just wanting to show/hide this part.
<strong style="display:inline" class="validate">First Name is required</strong>

anuradhay,
Do yo mean like this?
<div id="validateFirstName">
<strong style="display:inline" class="validate">First Name is required</strong>
</div>
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 82

Accepted Solution

by:
leakim971 earned 1600 total points
ID: 37827402
so use :
        $("label[for='" + $(this).attr("id") + "']").find("span").show();
and :
        $("label[for='" + $(this).attr("id") + "']").find("span").hide();

check the page updated : http://jsfiddle.net/hJXug/2/
0
 
LVL 8

Author Comment

by:JRockFL
ID: 37827440
leakim971,

Thank you! I'm going to do it slightly different,
Is this syntax correct?

 $("label[for=txtBillingFirstName").find("span").show();
0
 
LVL 82

Expert Comment

by:leakim971
ID: 37827447
it will work only for this one... so you will need to create a code for each input.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
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…
Suggested Courses

647 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