I want to change the values of a select box based on the value in other in a Web Page.
When the page is loaded I store the keys and values in a hash. So when I change the value in field1 it calls javascript function and the values in field2 should change as per the hash.
Hash:
%hash = ('factory1','model1','factory2','model2','factory3','model3');
jQuery Function:
\$('#factory').change(function(){
var factoryVal = \$(this).val();
\$('#model').val()="$hash{"+factoryVal+"}" ;
});
How can I do it?