I have a drop-down list, which contains a list of over 150 schools. Each school in this drop-down list is located in one of 30 states. What i'm trying to implement is this: If a user chooses a school from the "select" list, the text box below it would automatically show the state where that school is located. I'm not sure of the most efficient way to go about this. How do i go about it?

Thanks in advance.

Recommended Answers

All 2 Replies

There is a few ways that I can think of. For example, you can grab the value and send that value back for a DB lookup via Ajax, receive the result and display it

Or if your select (drop down) element's option elements can have this info already, possibly by having a "data-" attribute. So when you make a selection, have your javascript look at th data- attribute and pull the value from there so there isn't any call back.

w3school has something ur looking for Click Here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.