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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:11:19+00:00 2026-05-30T22:11:19+00:00

First, the html: <input type=radio name=selectrad class=rad data-min=2 /> <input type=radio name=selectrad class=rad data-min=5

  • 0

First, the html:

<input type="radio" name="selectrad" class="rad" data-min="2" />
<input type="radio" name="selectrad" class="rad" data-min="5" />

<select name="minimum" class="minimum">
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
  <option value="5">5</option>
  <option value="6">6</option>
  <option value="7">7</option>
  <option value="8">8</option>
  <option value="9">9<option>
  <option value="10">10</option>
</select>

What I’ve been trying to do is append or remove options from the dropdown based on the value of ‘data-min’ on the radio button clicked. So if ‘data-min’ contains 5, only options 5-10 will show. I’ve tried finding the difference between the two and adding or subtracting that way with no luck.

I’m trying to avoid the easy way of just grabbing the radio value, looping through with for (i=0; i<min; i++) and replacing the html, as this code should be as fast and efficient as possible.

  • 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-30T22:11:20+00:00Added an answer on May 30, 2026 at 10:11 pm

    Would something like below help? Its a basic code to which you can add based on your conditions. If the data-min is 2, everything from 3 to 10 will be hidden, and it its ‘5’, everything before 5 would be hidden

                   $(document).ready(function(){
               $("input[name='selectrad']").click(function(){
                   // console.log($(this).attr("data-min"));
                    if($(this).attr("data-min") === '2'){
                        $(".minimum").find("option").show();
                        var min = $(".minimum").find("option:gt(1)");
                        min.hide();
                    } else {
                        $(".minimum").find("option").show();
                        var max = $(".minimum").find("option:lt(4)").hide();
                        max.hide();
                    }
               })
            })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following HTML: <div class=row1> <input type=radio name=group1 value=0 checked=checked/>Zero <input type=radio
Perfectly normal radio buttons in HTML look like this: <input type=radio name=somename value=1>First</input> <input
Given the following HTML form: <form id=myform> Company: <input type=text name=Company value=ACME, INC./> First
I have the following HTML: <form id=test> <input type=radio value=A name=C1/> <a href=javascript:selectCheckbox('C1', 'A');>
Given the following HTML: <p id=noteTypebox> <label for=noteType_1 class=notetypelabel active id=noteType_1> <input type=radio name=noteTypeID
On my page i have radio buttons... <div class=stars-wrapper1> <input type=radio name=newrate value=1 title=VeryPoor
I have this HTML: <li> <input type=radio class=checkbox name=myName id=Id001/> One <img class=resetRadio src=star.png/>
I have this html <div> <input type=radio name=erp_report_type value=customerinvoice required> <label for=>Customer Invoice</label> <input
My html. <input id=rdb1 type=radio name=rdbData checked=checked /> <input id=rdb2 type=radio name=rdbData /> <asp:Button
Here's the html for my button, according to Chrome: <input checked= type=radio class=edit bindable

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.