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

  • Home
  • SEARCH
  • 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 6700489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:49:16+00:00 2026-05-26T06:49:16+00:00

I have a code something below: function showHideOptions() { $(#template1, #template2, #template3, #template4).css(display,none); $(this).css(display,block);

  • 0

I have a code something below:

    function showHideOptions() {
        $("#template1, #template2, #template3, #template4").css("display","none");
        $(this).css("display","block");
}

And I have four select dropdowns, At a particular time I want to select only one on the option of template selector.

    <select id="masterdropdown">
        <option>T1</option>
        <option>T2</option>
        <option>T3</option>
        <option>T4</option>
    </select> 


<select id="template1" onchange="return showHideOptions();">
        <option>Template1</option>
        <option>Template2</option>
        <option>Template3</option>
        <option>Template4</option>
    </select> 


<select id="template2"  onchange="return showHideOptions();">
        <option>Template1</option>
        <option>Template2</option>
        <option>Template3</option>
        <option>Template4</option>
    </select> 

<select id="template3" onchange="return showHideOptions();">
        <option>Template1</option>
        <option>Template2</option>
        <option>Template3</option>
        <option>Template4</option>
    </select> 


<select id="template4" onchange="return showHideOptions();">
        <option>Template1</option>
        <option>Template2</option>
        <option>Template3</option>
        <option>Template4</option>
    </select> 

CSS:

#template1, #template2, #template3, #template4{display:none;}

Basically I have a top dropdown(masterdropdown), which is always Visible this is also a template selector, On select of its options I want to show a particular template drodown that corresponds to that selected option in masterdropdown. How can this be acheived in jquery. does $(this) not work in this case, being called from a function.

  • 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-26T06:49:16+00:00Added an answer on May 26, 2026 at 6:49 am

    See a working Demo http://jsfiddle.net/X5mWL/

    JS

    $(function(){
            $("#masterdropdown").change(function() {
                $("#template1, #template2, #template3, #template4").hide();
                $($("#masterdropdown").val()).show();
        });
    });
    

    HTML

     <select id="masterdropdown">
            <option value="#template1">T1</option>
            <option value="#template2">T2</option>
            <option value="#template3">T3</option>
            <option value="#template4">T4</option>
        </select> 
    
    
    <select id="template1">
            <option>Template1</option>
            <option>Template2</option>
            <option>Template3</option>
            <option>Template4</option>
        </select> 
    
    
    <select id="template2">
            <option>Template1</option>
            <option>Template2</option>
            <option>Template3</option>
            <option>Template4</option>
        </select> 
    
    <select id="template3">
            <option>Template1</option>
            <option>Template2</option>
            <option>Template3</option>
            <option>Template4</option>
        </select> 
    
    
    <select id="template4">
            <option>Template1</option>
            <option>Template2</option>
            <option>Template3</option>
            <option>Template4</option>
        </select> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code below: <?php function wp_copickpage() { color_option_update(); ?> <form method=POST action=>
When you have code like this: Something something = new Something(); BlahEntities b =
Right now, I have code that looks something like this: Private Sub ShowReport(ByVal reportName
I have jQuery code which looks something like this on Button1 Click $('table.result_grid tbody
I have code which needs to do something like this There is a list
I have see code like this Dim s as something = new something Dim
I have a code setup something like below, the image is part of a
I have this code which gives me the below output in firebug, so according
I have some code for validating date below: function validateForm() { var errFound =
I am currently using jquery function(below) to display a block on click of a

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.