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

The Archive Base Latest Questions

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

i had the following question. i want to update my subcategory select list when

  • 0

i had the following question.

i want to update my subcategory select list when the user select a specific leadcategory and show in other select list the subcategories.

The problem is that i can’t figure out when i’m selecting a another leadcategory my previous subcategory has to remove and fill with the new data depending wich leadcategory i selected.

For now i’ve the following code.

The data i parse is a json encode who looks like:

 Website.Config = {"categorieen":{"1":{"1":"Navullingen ","2":"Potloden"},"2":{"3":"Navullingen","6":"potloden","7":"testSubcategorie"}}}


    function onChangeSubcategorie(){

 categorieen = Website.Config.categorieen;

 $("form#overviewFilter select#cat").change(function() {
  var hoofdCategorie = $(this).val();
  var subcategorieen = categorieen[hoofdCategorie];

  for(var c in subcategorieen ) {
   var tekst = subcategorieen[c];

   if(hoofdCategorie == 1) {
    $('form#overviewFilter select#scat').append("<option value="+tekst+">"+tekst+"</option>");
   }else if(hoofdCategorie == 2) {

    $('form#overviewFilter select#scat').append("<option value="+tekst+">"+tekst+"</option>");
   }
  }
 });
}

thank you for helping.

  • 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-16T01:37:24+00:00Added an answer on May 16, 2026 at 1:37 am

    You need to clear #scat list first and then populate it with new data.

    You can do this using next statements:

    $('form#overviewFilter select#scat').empty();
    

    or

    $('form#overviewFilter select#scat').find('option').remove();
    

    More information: jQuery remove

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

Sidebar

Related Questions

I was reading another SO question Enums in Ruby and it had the following
I had a question answered which raised another one, why following does not work?
I had following cgridview in Yii application, I want to change date format in
I had the following problem today, and I was wondering if there is a
UPDATE OK, I figured it out. I had to call the following for varieties:
I want to implement an atomic transaction like the following: BEGIN TRAN A SELECT
I had the following question in a test today. But i had not see
Following on from another question I had here I've got a MainConfig object and
I had the following query that doesn't work and I was wondering how to
I had the following template that essentially changed the color of the border of

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.