By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,466 Members | 1,149 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,466 IT Pros & Developers. It's quick & easy.

How to change the next selectbox options according to the selected value

P: 11
if i have 2 selectboxes - one for state and one for the cities in this state, and i want to change the cities according to the choosen state, how do i do this?
(i have just 2 states and in the beginning it has the first and defult state)
i'm working with jquery (mvc3).
thanks.
Aug 18 '11 #1
Share this Question
Share on Google+
3 Replies


Dormilich
Expert Mod 5K+
P: 8,639
when you change the value of the state select, you make an AJAX request for the values of the second select and built that with these values.
Aug 18 '11 #2

P: 11
Thank you,
But finaly i did switch()
case...
$(#...).hide();
$(#...).show();
case...
$(#...).show();
$(#...).hide();
and it worked.
Aug 18 '11 #3

Dormilich
Expert Mod 5K+
P: 8,639
bear in mind that the more data or selects you have, the more data you have to load initially and the longer your toggle code gets.
Aug 18 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.