I would like to know how I can make a system type onclick
or click
for jQuery.
When the user presses the enter
key on a form it automatically clicks the button and sends the form with click
.
I know how to do but would like to learn this method as well.
code:
<script>
$("#envia").click(function(){
var campo = {
nome: $("#nome").val(),
email: $("#email").val(),
assunto: $("#assunto").val(),
message: $("#message").val()
};
if(!campo.nome || !campo.assunto || !campo.email || !campo.message){
$.alert({
title: 'Atenção',
content: 'Todos os campos sao obrigatorios!',
});
return;
}
});
</script>