I have a jQuery code that works when I insert it inside a script tag within the body. But it doesn’t work when I insert it in the head tag or include it as a js file.
Share
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.
Judging from your description you most probably forgot to put your script into a
$(document).readyfunction:Then you can place this wherever you want on the page (
head,body, external script, …).