$ is not defined [Break On This Error] $(document).ready(function() { this error in this code //jquery// 2 3$(document).ready(function() { 4 $(".image").click(function(){ 5 $(".jq").show(); 6 }); 7 $("button").click(function(){ 8 $(".jq").hide(); 9 }); 10 11 12 13}); in index file i have used <script type="text/javascript" src="jq.js"></script> please help
is the jq.js file in the header? is it in the same directory as the file with the above code in? Try wrapping the jQ in (function( $ ){ //code here })( jQuery ); Code (markup):
Replace code : <script type="text/javascript" src="jq.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
Why would you tell him to use an old version? Â Use the current version man. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" />
you got the error because you didnt included the jQuery library on your page. So include the jQuery library using as freelancewebas mentioned. And hopefully you will be able to get rid of error.
Well, while we're on the subject. CDN with fallback and protocol relative URL: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="/path/to/fallback/jquery-1.6.2.min.js"><\/script>')</script>