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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:15:46+00:00 2026-06-05T19:15:46+00:00

In onchange event is not working in jquery.selectbox-05, i am using two dropdown box

  • 0

In onchange event is not working in jquery.selectbox-05, i am using two dropdown box one for country another one state if i select the country the state will pickup automatically it’s work in normal php dropdown but i use this code in jquery.selectbox it’s not working anybody will help me

Here my code

<script type="text/javascript" src="scripts/jquery.selectbox-0.5.js"></script>
<script type= "text/javascript" src = "scripts/countries2.js"></script>
$(document).ready(function(){
    $('.selectBoxMedium').selectboxMedium();
    $('.selectBoxSmall').selectboxSmall();
    $('.selectBoxSmallest').selectboxSmallest();
    $('.selectBox').selectbox();
    $(document).pngFix(); 
});
<p class="formInput formSelectBox">
    <select onchange="print_state1('state',this.selectedIndex);" id="country" class= "selectBox data" name ="country"></select>
</p>

<p class="formInput formSelectBox">
    <select name ="state" id ="state" class="selectBox"></select>
    <script language="javascript">print_country1("country");</script>
</p>

Javascript functions:

function print_country1(country_id) {
    // given the id of the <select> tag as function argument, it inserts <option> tags
    var option_str = document.getElementById(country_id);
    var x, i=0;
    for(x in country_arr){
        option_str.options[i++] = new Option(country_arr[x],country_arr[x]);
    }
}

function print_state1(state_id, state_index) {
    var option_str = document.getElementById(state_id);
    var x, i=0;
    state_index++;
    var state_arr = s_a[state_index].split("|");
    for(x in state_arr) {
        option_str.options[i++] = new Option(state_arr[x],state_arr[x]);
    }
}
  • 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-05T19:15:48+00:00Added an answer on June 5, 2026 at 7:15 pm

    Here’s your problem… this plugin don’t handle with dynamic options. I mean, when you do $element.selectbox() the plugin executes with the actual options for the select element and will not update the selectbox if you changes the options.

    So, if you have a select element with no options and run the selectbox plugin, it will create a selectbox with no options elements. When you changes the country and do a “reload” in the options for select#states, all the states for the selected country are loaded and added as options for select#states element, but the plugin selectbox was executed in page load and will not reload the options in their elements 🙁

    How to fix it? In your case, you should be able to remove the siblings of select#state (generated by selectbox plugin), update the options with new state values and then run again the selectbox plugin 🙂

    Check this functional jsfiddle 🙂

    PS: this fiddle is working with countries-3.1.js, the jquery.selectbox-0.5 and no CSS

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

Sidebar

Related Questions

I am using onclick event in option tag for select box <select> <option onclick=check()>one</option>
I have a dropdown list. I am using onchange event of this dropdown to
I'm trying to create an onchange event using javascript on a select element. But
Setting onchange event for CheckBoxList using the following code doesn't work. chkListUserGroup.Attributes.Add(onchange, document.forms[0].isRecordModified.value='true';); How
I have a javascript that runs using the onchange event when a user enteres
I'm working on a project and have a jQuery event handler I made to
I am using a price range, ie jquery range slider. And i have two
i am using ckeditor,now i want to translate the content in onChange event using
I have a textbox with an onchange event. Why does this event not fire
<select onchange=alert();> <option>d</option> <option>de</option> <option>dewe</option> <option>dewee</option> </select> I want the onchange event of a

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.