Buon pomeriggio a tutti, ho un form che valida i campi attraverso uno script jQuery.
Se trova i campi vuoti, mi restituisce un'immage rossa,al contraio verde.
Putroppo questo script controlla tutte le input presenti nel form, quindi, ammettendo il caso, che un tot di input debbano restare vuote, cmq,cosi facendo, mi restituirebbe un errore.
Attraverso lo script che posto di seguito vorrei sapere cortesemente, come faccio per controllare alcune input ed altre no...
codice:
function validateStep(step){
if(step == fieldsetCount) return;
var error = 1;
var hasError = false;
$('#formElem').children(':nth-child('+ parseInt(step) +')').find(':input:not(button)').each(function(){
var $this = $(this);
var valueLength = jQuery.trim($this.val()).length;
if(valueLength == ''){
hasError = true;
$this.css('background-color','#FFEDEF');//colore rosa
}
else
$this.css('background-color','#FFFFFF');//colore bianco
});
var $link = $('#navigation li:nth-child(' + parseInt(step) + ') a');
$link.parent().find('.error,.checked').remove();
var valclass = 'checked';
if(hasError){
error = -1;
valclass = 'error';
}
$('<span class="'+valclass+'"></span>').insertAfter($link);
return error;
}
Grazie mille...