$('#cpseltop').change(function() {
var a = $(this).val();
$('.cpselhide').hide();
$('#cpsel' + a).show();
});
.cpselect{
display:block;
border:1px solid #999;
border-radius:9px;
outline:none;
width:100%;
padding:2px 5px;
cursor:pointer;
font-size:12px;
margin:7px auto;
text-transform:uppercase;
}
.cpselauth, .cpselmoder{
display:none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select class='cpselect cpseltop' id='cpseltop'>
<option value='status'>STATUS</option>
<option value='auth'>AUTHORS</option>
<option value='moder'>MODERS</option>
</select>
<select class='cpselect cpselstatus cpselhide' id='cpselstatus'>
<option value='all' data-max=54>ALL</option>
</select>
<select class='cpselect cpselauth cpselhide' id='cpselauth'>
<option value='all'>ALL</option>
</select>
<select class='cpselect cpselmoder cpselhide' id = 'cpselmoder'>
<option value='all'>ALL</option>
</select>
Selecting AUTHORS
and MODERS
causes the margin between cpseltop
and the next dropdown to increase compared to when I select STATUS
!
What is the reason behind this behavior?