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 8891385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:43:47+00:00 2026-06-14T22:43:47+00:00

I have a drop down that I check with jquery and if a certain

  • 0

I have a drop down that I check with jquery and if a certain value is selected then an input box is revealed. I need to compare the selected value with an array and if the selection matches one of the values in the array then the value must be added to my hidden field’s tag. Advice would be very much appreciated since my jquery knowledge is next to none

My current code:
(I will query my database to get all the child values of trekkers and that will be my array)

<script type="text/Javascript">
        jQuery(function ($){
            $(document).ready(function () {
                    $(".kw").hide();
                });

            $(function(){
                $('.postform').change(function() {
                    var selectData = $(this).attr("data-select");
                    var selectValue = $(this).val();
                    $('.kw').hide();
                     if($("fieldset[data-select='" + selectData + selectValue +"']").css("display") == "none"){
                         $("fieldset[data-select^='" + selectData + "']").hide();
                         $("fieldset[data-select='" + selectData + selectValue +"']").show();
                     }
                });
            });
        });
        </script>

<form role="search" method="get" id="equipfilter" action="">
 <fieldset>
  <select name="exc_equipment_cat" id="exc_equipment_cat" class="postform" data-select="select1">
    <option class="level-0" value="allerlei">Allerlei&nbsp;&nbsp;(10)</option>
    <option class="level-0" value="implemente">Implemente&nbsp;&nbsp;(97)</option>
    <option class="level-1" value="balers-toebehore">&nbsp;&nbsp;&nbsp;Balers &amp; Toebehore&nbsp;&nbsp;(4)</option>
    <option class="level-1" value="disse">&nbsp;&nbsp;&nbsp;Disse&nbsp;&nbsp;(4)</option>
    <option class="level-1" value="hammermeule">&nbsp;&nbsp;&nbsp;Hammermeule&nbsp;&nbsp;(4)</option>
    <option class="level-1" value="ploee">&nbsp;&nbsp;&nbsp;Ploeë&nbsp;&nbsp;(11)</option>
    <option class="level-1" value="ripper">&nbsp;&nbsp;&nbsp;Ripper&nbsp;&nbsp;(8)</option>
    <option class="level-0" value="trekkers">Trekkers&nbsp;&nbsp;(43)</option>
    <option class="level-1" value="case">&nbsp;&nbsp;&nbsp;Case&nbsp;&nbsp;(4)</option>
    <option class="level-1" value="fiat">&nbsp;&nbsp;&nbsp;Fiat&nbsp;&nbsp;(5)</option>
    <option class="level-1" value="ford">&nbsp;&nbsp;&nbsp;Ford&nbsp;&nbsp;(1)</option>
    <option class="level-1" value="john-deere">&nbsp;&nbsp;&nbsp;John Deere&nbsp;&nbsp;(13)</option>
    <option class="level-1" value="landini">&nbsp;&nbsp;&nbsp;Landini&nbsp;&nbsp;(5)</option>
    <option class="level-1" value="massey-ferguson">&nbsp;&nbsp;&nbsp;Massey Ferguson&nbsp;&nbsp;(3)</option>
    <option class="level-1" value="mccormick">&nbsp;&nbsp;&nbsp;McCormick&nbsp;&nbsp;(4)</option>
    <option class="level-1" value="new-holland">&nbsp;&nbsp;&nbsp;New Holland&nbsp;&nbsp;(8)</option>
 </select>
</fieldset>
<fieldset class="kw" data-select="select1 WHERE VALUE SHOULD BE ADDED" style="display: none;">
  <legend>Kw Range:</legend>
  <input type="text" name="kw_min" placeholder="min" value=""><br>
  <input type="text" name="kw_max" placeholder="max" value="">
 </fieldset>
 <fieldset>
  <legend>Price Range:</legend>
  <input type="text" name="pr_min" placeholder="from" value=""><br>
  <input type="text" name="pr_max" placeholder="to" value="">
 </fieldset>
<input type="submit" id="filtersubmit" value="Search">
</form>

This is in response to this question

  • 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-06-14T22:43:48+00:00Added an answer on June 14, 2026 at 10:43 pm

    i hope this helps you

    var values = ['a', 'b', 'c'];
    jQuery('your-selector-to-select').change(function(){
        var j = jQuery(this);
        if(values.indexOf(j.val()) >= 0) {
            jQuery('hidden-selector').val(j.val());
        }
    });
    

    answer to your first question:

    jQuery('your-fieldset-selector').attr('data-select', 'select1 ' + j.val());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a drop down that I need to compare the values ( the
I have to create the Jquery Grid that have check boxes and drop down.
I have a drop down list that has options that need to be passed
I want to have a drop down box that has a list of different
I have a checkbox when user checked that check box means. I need to
I wanna have a drop down that lets me select Week Commencing Monday the
I have some drop-down boxes that act as filters on a page. When either
Currently have a drop down menu that is activated on a hover (from display:none
I have a drop down list that triggers an updatepanel when the index is
I have a drop down menu that looks great when the page it scrolled

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.