0
I’ve researched several topics and I haven’t found the problem. Simply put, the functions I use in jQuery, such as tooltip and Mask, do not work on my page, and by giving F12 in the Chrome browser, informs that jquery is not imported (Uncaught Referenceerror: $ is not defined javascript). I was using jquery on the machine, and I switched to Cdn and the problem persists. I imagine it’s something relatively silly, but I’ve been trying for days to solve the problem.
html:
<!DOCTYPE html>
<html>
<head>
<title>Semana da Engenharia</title>
<meta charset="utf-8">
**<script src="js/js.js" type="text/javascript"></script>**
**<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js" type="text/javascript"></script>**
<!-- responsável pelas funções de máscara em jQuery -->
**<script src="js/jquery.mask.min.js" type="text/javascript"></script>**
<link rel="stylesheet" type="text/css" href="cssIndex.css">
<!-- responsável pelas funções em boostrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!-- responsável por instanciar os icones -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<img src="bannerWeek.jpg" id="bannerWeek">
<div id="divLogin">
<select required id="comboboxLogin">
<option value="" disabled selected>Selecione o tipo de usuário</option>
<option value="administrador">Administrador</option>
<option value="visitante">Visitante</option>
</select>
<input type="text" name="senhaUsuario" id="senhaLogin" placeholder="Informe sua senha">
<span class="iconInPasswordField"><i class="fa fa-lock"></i></span>
<span id="iconInPasswordField" data-toggle="tooltip"
title="A sua senha é o seu RA!"><i class="fa fa-info"></i></span>
<input type="submit" value="ACESSAR" id="btnAcessar" onclick="enviarLogin()">
</div>
<span id="edicao2019">6º Edição - 2019</span>
<span id="unifaeLogo">UNI<span style="color: red">FAE</span></span>
</body>
</html>
javascript:
/*responsavel pela mensagem de ajuda "qual minha senha?"
o que ele faz realmente?*/
$(document).ready(function(){
$("#senhaLogin").mask("99999-9");
$('[data-toggle="tooltip"]').tooltip();
});
/* redireciona para a respectiva página de acordo com o usuário*/
function enviarLogin(comboboxLogin) {
var op = document.getElementById("comboboxLogin").value;
if(op == "visitante") {
window.location.href = "userPage.html";
}
else
if (op == "administrador") {
window.location.href = "admPage.html";
}
else
alert("Informe o tipo de usuário!");
}
Expensive your tags that import the scripts should come last in the document. And the scripts you write should come even after these imported scripts.
– hugocsl
I put them all after the body (imported and then the js and css I created) and it didn’t work :/ I put them all after the body and it still doesn’t work :/ . . . In addition, new errors appeared: . . . Failed to load resource: net::ERR_FILE_NOT_FOUND /////// jquery.mask.min.js:15 Uncaught TypeError: Cannot set property 'maskWatchers' of undefined /////// at jquery.mask.min.js:15 at jquery.mask.min.js:6 at jquery.mask.min.js:6 ////// bootstrap.min.js:6 Uncaught Error: Bootstrap’s Javascript requires jQuery at bootstrap.min.js:6 //// js.js:4 Uncaught Referenceerror: $ is not defined at js.js:4 //
– Weslley Fillipe