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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:16:29+00:00 2026-05-23T05:16:29+00:00

I am working on this website here http://offline.raileisure.com/ on the right there are some

  • 0

I am working on this website here http://offline.raileisure.com/

on the right there are some options to book a reservation..

Where it says No. of Adults and No. of Children, I need this to be limited to x per property..

i.e. if the Station Masters House is selected its maximum occupancy is 8 people..

So if 5 Adults are selected I need the Children select menu to only show the difference between 5-8 if that makes sense..

Otherwise someone could book 5 children and 5 adults… and that would be more than the maximum 8…

Same as if the carriage is chosen the maximum occupancy is 4

Thanks

Lee

  • 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-23T05:16:30+00:00Added an answer on May 23, 2026 at 5:16 am

    have a look at the jquery change event

    http://api.jquery.com/change/

    you can use this event to edit the other input and only make the options available that are still left.

    here is the code that does exactly what you want:

    var max = 8;
    
    for (var i = 0; i <= max; i++) {
        $("#children, #adults").append($("<option></option>").attr("value", i).text(i));
    }
    
    $("#adults").change(function() {
        var sel = $("#children").val();
        $("#children").html("");
        for (var i = 0; i <= max - parseInt($("#adults").val()); i++) {
            $("#children").append($("<option></option>").attr("value", i).text(i));
        }
        $("#children").val(sel);
    });
    
    $("#children").change(function() {    
        var sel= $("#adults").val();
        $("#adults").html("");
        for (var i = 0; i <= max - parseInt($("#children").val()); i++) {
            $("#adults").append($("<option></option>").attr("value", i).text(i));
        }    
        $("#adults").val(sel);
    });
    

    working example: http://jsfiddle.net/geertvdc/ADC3a/

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

Sidebar

Related Questions

I'm working on this website http://www.eluminatecreative.com/new/index.html and where it says sum'r fling I need
I'm currently working on a website that you'll find here: http://steadfastdesignfirm.com/rgw/ . I used
I'm currently working on this website (http://www.jowannes.com/thomasschoof/flash/LauraBarsby.html) and I created a little gallery. When
I'm working on a website located here: http://www.travelanchevacations.com/mainlogin.aspx When trying to login, I get
I'm working on this test website before publishing it: http://www.mjmwebstudios.com/anchor The slideshow on the
Guys check this website on FF and Chrome For some reason(s), jQuery isn't working
Here is the website im working on: http://kognitek.nazwa.pl/stockize/mak/MMprodukcja/parallaxProject/stronaTestowa/test.html The site is flickering while scrolling
I referenced this website: http://biega.com/special-char.html to aid me in adding special characters in my
I'm working on a website with country maps see here: http://defenddefenders.huritech.org/ The challenge is
i have this example found here: http://threedubmedia.com/code/event/drag/demo/resize2 and i tried to reproduce it in

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.