Skip to content
Advertisement

Change options when I select a category using Javascript (Country/State)

Im trying to hide some options when I select a different country. These options are the states of this country. But, when I select the country, it doesnt showing nothing in the subcategory.

JavaScript
JavaScript
JavaScript

So, I try make differents values using numbers, coz I cant use the same values in my application. Someone can help me?

Advertisement

Answer

There are a few typos in your code, like wrong spelling of united states in the subcategory dropdown etc. I have changed your script to select only those subcategory options that begin with the name of the selected country by using(^).

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement