I'm trying to show a second select element only if a certain option of a first one is selected.
Should be straight forward but it doesn't work.
So I have a few of select elements of class "one" each followed by a select o class "two".
Within document ready function I first hide all of the selects of class "two": $('.two').hide();
works fine.
Then I have a function (also within document ready function) to show a next select of class "two" if a certain value is picked from the select of class "one".
$('.one').change(function() {
var two= $(this).next('.two');
if ($(this).val()==3){
if(two.is(':hidden')) {
two.fadeIn(50);
}else{
two.fadeOut(50);
}
}
});
Can someone tell me what am I doing wrong?