So I have the following code setup so that when and only when a user checks Other, then the "If other box" shows. Doing so leaves empty space when the box is hidden. Is there anyway to get rid of this when the box is unchecked and scroll the content down and add the "If other box" when the Other box is checked.
Here is the following working code
$('#other').on('click', function() {
if ($(this).is(':checked')) {
$('.otherCon').css('visibility', 'visible');
} else {
$('.otherCon').css('visibility', 'hidden');
}
});
.otherCon {
visibility: hidden;
}
label {
display: block;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
<div class="userCheck">
<input type="checkbox" id="other" name="Other" value="Other" />
<label>Other</label>
</div>
<div class="otherCon">
<label>If other</label>
<textarea id="text" name="Other Response"></textarea>
</div>
<div>
<label>More info</label>
<textarea id="text" name="More info"></textarea>
</div>