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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:25:20+00:00 2026-06-10T07:25:20+00:00

I have a JQuery code I have been using for some time however today

  • 0

I have a JQuery code I have been using for some time however today I ran into a roadblock – this roadblock comes in the form of an array input.

<div id="primary">   //oopse this one contains the survey info
<input type="radio" name="quest[]" value="yes">   //was typing fast didnt realize i typed checkbox meant radio
<input type="radio" name="quest[]" value="no">
</div>
<div id="idnum">   // this one shows only if yes is selected
blah blah blah
</div>

So the inputs are sending to query[]
the logical thing to me says to not use an array – however this is not an option.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>

  $(document).ready(function () {
    $("#quest[] selected").change(function (e) {
      if ($(this).val() == "Yes") {   //if query[] = Yes then run following
        $("#idnum").hide();            //hide div id=idnum
      }
      else {     //if it no longer shows yes then run following
        $("#idnum").show();    //show div id=idnum
          }     
    });
  });

array[] has other values under this array for other questions also
how do I fix this to focus on a specific input in the array – each div has a different id and I do have the ability to find the array[number] if need be.

sorry fixed some things and annotated a little

I dont know if it is possible but is it possible to find the with a value of “Yes” that is listed in a specific

  • 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-10T07:25:21+00:00Added an answer on June 10, 2026 at 7:25 am

    jsFiddle DEMO

    // to grab them by name starting with "quest[" the rest will be dynamic you said
    $('[name^="quest["]').on('change', function () {
        if ($(this).attr('value') === 'yes') {
            $(this).closest('div').hide();
        }
    });
    

    If I understand the question correctly, and you are trying to hide the nearest parent <div> and hide it, if they select YES.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been struggling with this for quite some time now. jQuery.ajax in the
I have some jQuery code like this : $(function($) { $('input.autonumeric').autoNumeric({aSep: ',', aDec: '.',vMax:'1000000000000'});
I've been using jquery to do some image swapping and fading. I have a
I have been doing some customization to this jQuery paging script I found here
I have been using the jQuery nyroModal plugin for a little bit of time,
Ok, I haven't been using JavaScript without JQuery for quite some time now... But,
I have been using javascript for some while now and recently began using jquery
I have been going through the core jQuery code and had a few why
I have jQuery code which looks something like this on Button1 Click $('table.result_grid tbody
I have this jQuery code: $(document).ready(function() { $.ajax({ url: pages/+page+.php, cache: false }).done(function( html

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.