0
I have a submit button in my form, with an action in jquery to open a window depending on the user’s choice. However, I just want the window to open if the fields are filled.
I have this code and want to merge with an if.
$(function() {
$('#chkveg').multiselect({
includeSelectAllOption: true
});
$('#btnget').click(function() {
window.open($('#chkveg').val());
})
});
For example:
IF (#FORM).REQUIRED = TRUE {
(#BUTTON).WINDOWOPEN
}
My form is simple:
<form action="http://formmail.kinghost.net/formmail.cgi" method="POST">
<input name="nome" type="text" class="nome" id="nome" required width="100%" placeholder="Nome:">
<input name="cpf" type="text" class="cpf" id="cpf" placeholder="CPF:">
<div style="clear:both"></div><br/>
<input name="nascimento" type="text" class="nascimento" id="nascimento" placeholder="Data de nascimento:">
<select id="chkveg">
<option value="https://pag.ae/7ULKPL7TH">Associados Ancord + C.Dados = R$700,00</option>
<option value="https://pag.ae/7ULKQ8Zm2">Associados Ancord = R$800,00</option>
<option value="https://pag.ae/7ULKQLB9m">Associados Entidades Apoiadoras + C.Dados = R$800,00</option>
</select>
<input id="btnget" class="submit-btn" type="submit" value="INSCREVER-SE">
</form>
Someone can help me?
Show! was just what I needed! my god I have to study urgent jquery
– Chead
@Chead but the solution presented is pure javascript :P
– Leandro Angelo
better study pure javascript and then jquery?
– Chead
I was just commenting that on
let formValido = document .getElementById("meuForm").checkValidity();
no use of Jquery heheheh– Leandro Angelo