Display x if x display y if y (bad title I know)
- by user1914940
Ok so after reading the title you are most likely like...what?
Ok, so I have a jquery code that displays 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.