Jquery – Funções show() e hide()

Validando um formulario de contato

// validação do contato – Array contento as mensagens de retorno
msgs = new Array();
msgs['email'] = “Por favor preencha seu e-mail”;
msgs['assunto'] = “Por favor preencha o assunto”;
msgs['mensagem'] = “Por favor preencha a mensagem”;

var a = ’2′;

function valid_all( form_id ) {

$(‘#’+form_id+’ :input[@class="requerido"]‘).each(function () {

if($(this).val() == ”) {
//alert (msgs[$(this).attr('id')]);
$(“#msg”).html(msgs[$(this).attr('id')]);
$(“#msg”).show(1000);
$(“#msg”).hide(1000);

$(this).focus();
a = ’1′;
return false;
}
else{
a = ’2′;
return true;
}
})

if(a == ’2′){

$(“#msg”).html(“válido”);
$(“#msg”).show(“slow”);
$(“#msg”).hide(“slow”);

$(‘#form1′).submit();
}
}

/***************************************/

.
.
.
Seu e-mail:
Assunto:
Mensagem:

.
.
.

Veja mais exemplos:

http://www.learningjquery.com/2006/09/slicker-show-and-hide

http://www.rafaelcunha.com/2007/06/13/showhide-abrirfechar-do-jquery-para-menus/

Posted in Jquery | No Comments »

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.