Include an .js file in an MVC project. my .js file looks like this:
$(document).ready(function() {
function escondePanel(painel) {
$("#pnPessoal").css("display", "none");
$("#pnContato").css("display", "none");
$("#pnDocumento").css("display", "none");
$("#pnOutro").css("display", "none");
$(painel).css("display", "block");
}
$("#pessoal").on("click", function () {
escondePanel("#pnPessoal");
});
$("#contato").on("click", function () {
escondePanel("#pnContato");
});
$("#documento").on("click", function () {
escondePanel("#pnDocumento");
});
$("#outro").on("click", function () {
escondePanel("#pnOutro");
});
});
I included the .js file in Mmnha view like this:
@Scripts.Render("~/Scripts/code-servidor.js")
But the code is not working and I'm getting the error in the console:
ReferenceError: $ is not defined - line 1.1
What's wrong? I've copied the structure of another file that works normally.