0
Guys I’m having a problem in my jquery, the code below shows the moment that I register the Submit event by clicking on the button
$("#quero-me-identificar").click(function () {
if($(this).is(":checked")){
$("#painel-dados-usuario").show();
$("#login-card").show();
abrirLogin();
}
});
function abrirLogin() {
$("#loginForm").submit(function (event) {
console.log("sdf");
event.preventDefault();
});
}
My html code
<form id="loginForm" method="post" action="">
<button id="entrar" class="botao-login" style="float: left;margin-right: 15px">
Entrar
</button>
</form>
The problem that occurs is that the action does not enter the event Submit, I’ve already done one $("#loginForm").length
and he can identify that there is a form
I’ve tried other ways and I can’t get anyone to help me
To make the Submit event occur via javascript you need to give a Trigger on it $("#loginForm"). Trigger('Submit');
– Zorkind
Actually it doesn’t need, um
$("#loginForm").submit();
would suffice, but he’s giving aevent.preventDefault();
then he’ll need to make one$("#loginForm").unbind('submit').submit();
– Erlon Charles
'Cause I did it that way and it worked when I click the button being the button type but when I click the button like Ubmit to give the Ubmit it does not fall in the event that I registered understood.
– Jacob de Oliveira
You want to remove the
event.preventDefault();
?– Sam
I didn’t want it to continue, I wanted it to enter the Submit event that I registered and then stop with Event.preventDefault();
– Jacob de Oliveira