I\'m implementing a system these days, i want to implement a combo box selection process but i don\'t know how to implement it, so asking you guys favor?
my scenario
The trick is do subscribe to the change event and reset the contents of the second box accordingly.
HTML:
JavaScript (on ready):
var selectBrand = $("#brand");
var selectType = $("#type");
var optionsList = {
nokia: [
"C6-01",
"E7-00"
],
apple: [
"iPhone 3",
"iPhone 3G",
"iPhone 4"
]
};
selectBrand.change(function() {
var brand = selectBrand.val();
var options = optionsList[brand];
var html;
if (options) {
html = '';
$.each(options, function(index, value) {
html += '';
});
} else {
html = '';
}
selectType.html(html);
}).change();
Full example at See http://www.jsfiddle.net/TJJ8f/