I'm new for jquery. How to make jquery works after I copied some code to my web editor? Because it always shows me an error message after I run it. Thanks Kent
What was the error message? Have you included the Jquery library? <script type="text/javascript" src="jquery.js"></script>
Hello, Thanks for your mail. Here is the message below: How to make code works without this error? Webpage Error Do you want to debug this webpage? This webpage contains errors that might prevent it from displaying or working correctly. If you are not testing this webpage,click No. Line:16 Error: Object doesn't support this property or method
Unfortunately, the error message is too vague. We need to see the source code too, or just the section containing line 16.
Here is the source code below, it shows error after I run this code. <html> <head> <script src="prototype.js"></script> <script src="jquery-1.4.3.js" type="text/javascript"></script> <script> jQuery.noConflict(); // Use jQuery via jQuery(...) jQuery(document).ready(function(){ jQuery("div").hide(); }); // Use Prototype with $(...), etc. $('someid').hide(); </script> </head> <body></body> </html> Thanks for help. K
it would be interesting what you try to achieve with your code? the code you copied would simply hide all the divs on your page, so right now it wouldn't do anything really anyhow... I don't know why you are using prototype too in there. Try to put out the prototype code at first, get some divs into the body and see if the error is still there. Unfortunately I don't know prototype, so I can't say if there's a problem with that one code line...
I tried this code and had same problem and error message. <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("p").click(function(){ $(this).hide(); }); }); </script> </head> <body> <p>If you click on me, I will disappear.</p> <p>Click me away!</p> <p>Click me too!</p> </body> </html>
Alright, this is weird. What version of jQuery are you using? Try downloading the latest one from the jquery-website.
What browsers are showing the error? Is it a PHP or HTML file? That second script works fine, so maybe the errors are from a cached version of the first script.