I have a form
<div class="componenti_attive riquadro" style="display: block;">
<h2>LE COMPONENTI POSITIVE DEL TUO BILANCIO</h2>
<p class="title redd1 has-success" style="display: block;">Reddito mensile del primo componente
<input name="reddito1" type="text" class="form-control num positivi valid" placeholder="Redditi primo componente ..." data-validation="number" data-validation-error-msg="Inserisci solo numeri senza virgole e decimali!" data-validation-optional="true" style=""></p>
<div class="btnPrint indietro1"><h2 class="stamp printMe">INDIETRO</h2></div>
<div class="btnPrint avanti2 avant"><h2 class="stamp printMe">AVANTI</h2></div>
</div>
I have jquery Validator (the input object must be number) In case of error must be appear a span object (class form-error):
<p class="title redd_altri1 has-error" style="display: block;">Indicare il totale degli altri redditi (es. pensioni, indennità, rendite, etc.)
<input name="altri_redditi" type="text" class="num positivi form-control error" placeholder="Inserisci qui il totale mensile degli altri redditi ..." data-validation="number" data-validation-error-msg="Inserisci solo numeri senza virgole e decimali!" data-validation-optional="true" style="border-color: red;"><span class="help-block form-error">Inserisci solo numeri senza virgole e decimali!</span></p>
I would like that, if this object is displayed so the div class avant is hide
<div class="btnPrint avanti2 avant"><h2 class="stamp printMe">AVANTI</h2></div>
I have this js
$form.on('change', '.num', function ()
{var $errori = $('.form-error').length;
if ($errori > 0)
{$('.avant').hide();}
else {$('.avant').show();}
});
but it doesn't work!!