So, I want to make a dynamic little script to select countys and then cities. Well, I have all the counties and cities in the mysql database. If I select a county in the tag <select>, then the cities belonging to the county should appear in the next tag <select>.
So maybe I could do something like
$(document).ready(function() {
$('.county').click(function(){
$(this.name).toggle();
});
});
where the countys option might look something like this:
<option value="This County" name="This County" class="county">This County</option>
When I click it above, each city connected to "This County"should appear. You just need to be fined a bit on this one. Does anyone think they can help?
source
share