Ok, so I have some jQuery code that displays an input box if an item with prefix Blue from dropdown menu is selected.
Code:
$(function() {
$('#text1').hide();
$('#select2').on('change', function(event) {
var opt = this.options[ this.selectedIndex ];
var picked_blue = $(opt).text().match(/Blue/i);
if(picked_blue) {
$('#text1').show();
} else {
$('#text1').hide();
}
});
});
But what I also need to add is to display something else if any other item from dropdown menu is selected. And what I need to display is another dropdown menu of items.
Shouldn’t this work for you:
where
text1andtext2share the position in the DOM, with texts like ‘blue’ and ‘not blue at all’, respectively?