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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:17:26+00:00 2026-06-18T09:17:26+00:00

I have a HTML page using Jquery select option as given below.. <select id="select-stage"

  • 0

I have a HTML page using Jquery select option as given below..

<select id="select-stage" class="spinner" data-inline="true" >
    <option value="-1">-Select Stage-</option>
</select>

Now the contents of this select option are give dynamically by an ajax call result.

This is how it looks like

enter image description here

When I click the user option for the first time it is not getting selected. But whereas other options HOD1, HOD2, HOD3 etc. are getting selected properly. This only happens for the first time after load. If I select other options and then again select user it is getting selected.

It does not get selected only for the first time. I can’t spot the problem.

var option=[];
$.each(myData, function(key, val) {
    sessionStorage.setItem(trim(val),trim(key));
    option.push('<option value="' + trim(key) + '">' + trim(val) + '</option>');
});
$('#select-stage').html(option.join(''));
}

//changing values on user selection//
$('#select-stage').live('change',function(){
    stageId = sessionStorage.getItem($(this).find('option:selected').text());
    selecttext = $(this).find('option:selected').text();
    noselection = true;
    listStageselectedIndexChanged(selecttext);
});
  • 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-18T09:17:27+00:00Added an answer on June 18, 2026 at 9:17 am

    This is because you are replacing the first item in the select – which is already selected, therefore the change event is never fired.

    You need to keep the -Select Stage- option in there as the default and append the new options beneath it. Then when any other option is selected, the change event will be fired.

    UPDATE

    To achieve this modify your code to prepend the default option, like this:

    var option=[];
    $.each(myData, function(key, val) {
        sessionStorage.setItem(trim(val),trim(key));
        option.push('<option value="' + trim(key) + '">' + trim(val) + '</option>');
    });
    $('#select-stage')
        .html(option.join(''))
        .prepend('<option value="-1">-Select Stage-</option>')
        .val('-1');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have the following HTML: <option value=4def1b88a1247><a href=link>Text</a></option> When using jquery-ui select menu, the
I have this html on a web page: <select name=chapter_select class=chapter_select> <option value=http://www.example.com/chapter/1>Chapter 1</option>
I am using jQuery for a simple website and have a main page 'index.html'
I am using JQuery Accordion. I have this page here: http://www.hauppauge.com/site/support/support_colossus.html#tabs-6 What happens is
How do I apply Chosen jQuery in my html page? I have a select
I am using jquery validation plugin. I have an html that looks like: <h2>Select
I have a select option list and im using jQuery Mobile. My list is
I am using HTML and JQuery. I have got below HTML for the dropdown.
I have a HTML main page which is using jQuery mobile's UI. Somewhere on
I have saved an html page using the following line of code : NSURL

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.