I have a dropdown here which is controlled by another dropdown as,
$("#change").change(function() {
    if(this.value == "x") {
        $("#mydp").parent().show();
       $( "#mydp option[value='r']" ).nextAll().andSelf().css("display", "none");
         $( "#mydp option[value='r']" ).prevUntil( "#mydp option[value='']" ).css("display", "initial");
    } else if(this.value == "y") {
          $("#mydp").parent().show();
      $( "#mydp option[value='r']" ).nextAll().andSelf().css("display", "initial");
         $( "#mydp option[value='r']" ).prevUntil( "#mydp option[value='']" ).css("display", "none");
    } else {
         $("#mydp").parent().hide();
    }
});
If I select y in first dropdown, why the height of second dropdown's selectbox become reduced and how can i set auto height for it?