jQuery function on element click doesnt work only from external file

Caveentaica

New Member
I have html element with id:\[code\]<img id = "ShowOrHideImage" src="http://stackoverflow.com/questions/13876896/~/Images/show_expander.png"/>\[/code\]when I place script to to html, I can get message after click:\[code\]<script> $("#ShowOrHideImage").click(function () { alert("function invoked"); });</script>\[/code\]But when I put script to external file MyScript.js:\[code\]alert("Script is there");$("#ShowOrHideImage").click(function () { alert("function invoked");});\[/code\]I get message "Script is there" but never "function invoked"I don't know what is the reason. Any ideas? Thank You in advance.
 
Back
Top