How to use AJAX to populate state list depending on Country list?

前端 未结 6 830
我在风中等你
我在风中等你 2020-12-06 15:01

I have the code below that will change a state dropdown list when you change the country list.
How can I make it change the state list ONLY when country ID number 234 an

6条回答
  •  醉梦人生
    2020-12-06 15:37

    EDIT: here is a solution that works quite well for the task, adapting the lines of Tvanfosson:

    
    
    
    
    
    
    
    
    
    

    As you can see, I eliminated the

    element which is not absolutely necessary but can be added (and then has to be used properly in case JS is deactivated at the users end. See here.

    I also eliminated the onchange event which is being replaced by the 'change()` jquery function.

提交回复
热议问题