Display x if x display y if y (bad title I know)
Posted
by
user1914940
on Stack Overflow
See other posts from Stack Overflow
or by user1914940
Published on 2012-12-19T11:01:46Z
Indexed on
2012/12/19
11:03 UTC
Read the original article
Hit count: 146
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.
© Stack Overflow or respective owner