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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:10:06+00:00 2026-05-15T12:10:06+00:00

HTML: <select id=staylength name=staylength> <option disabled=disabled value=1>1</option> <option disabled=disabled value=2>2</option> <option value=3>3</option> <option value=4>4</option>

  • 0

HTML:

<select id="staylength" name="staylength">
  <option disabled="disabled" value="1">1</option>
  <option disabled="disabled" value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
  <option value="5">5</option>
</select>

In Google Chrome (5.0.375.55 on WinXP), the following jquery code fails to set the value of staylength.

var my_min = 3;
$('#staylength').val(my_min);

But the same, when run from javascript console in Google Chrome, is successful. What Is wrong?

Edit
Here is the offending page:
http://dv2.makestay.com/node/1

To reproduce the error select either ’06/21/2010′ or ’06/22/2010′ as Check-In Date. The value failing to get updated is in Nights select.

EDIT 2

This is the whole function. It is called with parameter set to 3:

function apply_restriction(i) {
    var my_index = parseInt(i);
    var my_option;
    var my_min = min_stay[my_index];
    $('#staylength').html('');
    for (var j=1; j < 15; j++) {
        if (parseInt(j) < parseInt(my_min)) {
            my_option = '<option value="' + j + '" disabled="disabled">' + j + '</option>';
        } else {
            my_option = '<option value="' + j + '">' + j + '</option>';
        }
        $('#staylength').append(my_option);
    }
    $('#staylength').val('' + my_min);
    alert($('#staylength').length);
}
  • 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-15T12:10:07+00:00Added an answer on May 15, 2026 at 12:10 pm

    Updated

    The issue is this line:

    var my_min = min_stay[i] + 1;
    

    min_stay is an array of strings, so this is resulting in “31”, not 4 like you want (and “31” is outside the values in the list, resulting it it defaulting back to the first <option>), you either need to return an array of integers in your response, instead of this:

    min_stay.push('3', '3');
    //should be:
    min_stay.push(3, 3);
    

    or, use parseInt() like this:

    var my_min = parseInt(min_stay[i], 10) + 1;
    
    • 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 select element: <select id=publisher name=publisher> <option value=10>Google</option> <option value=11>Yahoo</option>
I have a classic HTML select box: Show: <select name=show id=showThreads> <option value=all selected=selected>All</option>
I currently have a HTML select box like below. <select name=item_1> <option value=0>Choose one...</option>
I have a normal HTML select dropdown box <select id=day name=day> <option value=0>All</option> <option
Take the below HTML select for an example: <select name=selValues id=selValues> <option value=1>One</option> <option
I have a HTML select like this: <select name=something> <option value=a>1</option> <option value=b>2</option> <option
I have a basic html select: <select> <option value=1>Apple</option> <option value=2>Banana</option> <option value=3>Grape</option> </option>
I have an html select: <select> <option>Choose one</option> </select> Using jQuery, is there an
Hi I have a html select tag like this: <select name = options> <option
I have a super basic HTML select form field - <select> <option value='1'>1</option> <option

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.