The next library is a very simple way to do it using JQuery.
https://github.com/simpleweb/jquery-dependent-selects
The only code you hace to write is like this.
</select><select name="location" class="dependent-demo1"><option></option><option value="238">London > North > Enfield</option><option value="239">London > North > Barnet</option><option value="240">London > South > Croydon</option><option value="241">London > South > Bromley</option><option value="242">London > South > Sutton</option><option value="243">Bristol > St Pauls</option><option value="244">Bristol > Horfield</option><option value="245">Bristol > Bedminster</option><option value="246">Bournemouth</option>
})$(function(){$('.dependent-demo1').dependentSelects();
Adding the JQuery library and the depend select one.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="jquery.dependent-selects.js"></script>
No comments:
Post a Comment