In the code snippet below, I am able to slide the sibling div up and down.
However, I now want to restrict this behavior when the element within it is assigned an error class.
Javascript
$('input').on('focus blur', function(e){
$(this).siblings('div')[e.type === 'focus' ? 'slideDown' : 'slideUp']('fast');
})
HTML
<div class="input">
<label>Name</label>
<input type="text">
<div>
<div class="addition error">Input error 1</div>
</div>
</div>
<div class="input">
<label>Rest</label>
<input type="text">
<div>
<div class="addition error">Input error 2</div>
</div>
</div>
<div class="input">
<label>Rest</label>
<input type="text">
<!-- Only this should be allowed to slide -->
<div>
<div class="addition">Input addition 1</div>
</div>
</div>