Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7498977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:39:33+00:00 2026-05-29T19:39:33+00:00

I have a form which has multiple input fields, and 3 main options. depending

  • 0

I have a form which has multiple input fields, and 3 main options. depending on what option the user selects I want to be able to hide non relevant fields and show relevant ones. please can some one advice me on how I may achieve this.

my second question is each field has some examples text next to it, so once again I want to be able to change the text depending on what the user selects. so far what i have done is display each text in a <p> tag next to the field and I have given it two classes. one is static which styles the text (.htxt) and the other is either .option1 .option2 .option3. so when a user clicks option one i want to hide all option2 and 3 text and show only 1. so i have something like this so far

    $(".link").click(function () {
        $(".hTxt").hide("slow");
        // this gets the id of the link (option 1, option2, option3)
        target = $(this).attr("id");
        $(".hTxt ." + target).show("slow");
    });

this doesn’t seem to work, I was wondering if any one could help me out with this.

the html for one of the text looks like so

<p class="hTxt option1" >help me</p>

while the link calling it looks like so

<a class="link" id="option1">this is option1</a>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T19:39:35+00:00Added an answer on May 29, 2026 at 7:39 pm

    you are saving an id but selecting a class with it; try like this instead

    $(".link").click(function () {
            $("#.hTxt").hide("slow");
            // this gets the id of the link (option 1, option2, option3)
            target = $(this).attr("id");
            $(".link #" + target).show("slow");   /* #id VS .class */
        });
    

    and here you do a mix: $("#.hTxt").hide("slow");

    if its a class-> $(".hTxt").hide("slow");

    if its an id -> $("#hTxt").hide("slow");

    -EDIT-

    i Am guessing by your comment that hTxt is a class, so please try like this and let me know

    $(".link").click(function () {
            $(".hTxt").hide("slow");
            // this gets the id of the link (option 1, option2, option3)
            target = $(this).attr("id");
            $(".link #" + target).show("slow");   
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have form that has multiple input text boxes, Which has got some text
I have a form-1 which has 4 fields. when the user inputs data in
I have a form which I want the user to be able to export
I have a form that has multiple input fields. I'm applying a bind() to
I have a form which has a lot of SELECTs. For various reasons, I'd
I have a form which has only tab control in it. I want to
I have this html form which has options: <tr> <td width=30 height=35><font size=3>*List:</td> <td
I have a form which has a Combo Box Control. I have selected the
I have WPF Form which has many buttons with the same code. Appearance of
I have a maximized form which has Combo-Box control (docked in top-right) with 500px

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.