I'm newbie in this forum and I'm having some issue in my jquery script. I have a form with many input text and I take each of them and I see if its value is empty. In my input file, I test if the extension's file is png or jpg, if not, a modal appears informing the correct file. The problem lies here, I can't get out from this step, my script simply doesn't work anymore. Here it's my jquery script ..
var foto = $("#fotoperfil").val();
// There are more else if above this
else if(senha != con_senha) {
erro.fadeIn().html("As senhas não conferem");
$("#senha").parent().addClass("has-error");
$("#con_senha").parent().addClass("has-error");
}
else if (foto != ""){
//recupero a extensão deste nome de arquivo
extensao = (foto.substring(foto.lastIndexOf("."))).toLowerCase();
//alert (extensao);
if(extensao != arquivo[0] && extensao != arquivo[1]) {
erro.fadeIn().html("Somente arquivos .jpg e .png são permitidos");
}
}
// There are more else if below that
The condition must be stopped when the user submit a valid file, if the input file is not empty, and the script keeps validating the other inputs.
Aucun commentaire:
Enregistrer un commentaire