In my view I have a reference to a JS file the I wrote. In that file I have only this code:
$(function () {
alert('x');
});
why it’s not being called while if I move that code into script tag inside the view it does being called?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Perhaps the referenced js file is being loaded before you have loaded jQuery? Or perhaps the js file is not being loaded at all?