Alright, this might be a little over my head, but I copied your text and made a little local site to text it out with 1.8.3.min.js and I noticed that there was some weird unseen characters in the source that isn't in the code. I'm no pro when it comes to UTF stuff and line ending, but check your source in the browser and make sure there isn't anything weird in your script that you don't see in your editor.
Just a couple of nitpicks, the below is the recommended way of writing jQuery.
// This is the shorthand way of writing $(document).ready()
$(function() {
// Since jQuery 1.5 its now recommend you use the on() method
$('p').on('click', function() {
// Always use "this" as it referrers to the current element context not every p element
$(this).hide();
});
});
@taragrg : For some reason i believe it may be some kind of syntax error. I suggest you either: A.) Upload your page to a server and post the link for us to see. B.) Copy ALL of your code and go to this website to convert characters. Once converted, come back to this forum, paste your new code, and wrap said new code inside of pre and code tags.
The reason for this is so we can see exactly what you are doing because even though @SgtLegend have some great advice and @kevin11189 even gave you a working example, i believe you are missing something.
this is the code and its not working i am using the CDN instead of local jquery and why is it not working thanks
It's working for me....
http://jsfiddle.net/kevin11189/ZJPD4/
yea its working in your framework kevin11189 but its not working in my browser dont know why
Alright, this might be a little over my head, but I copied your text and made a little local site to text it out with 1.8.3.min.js and I noticed that there was some weird unseen characters in the source that isn't in the code. I'm no pro when it comes to UTF stuff and line ending, but check your source in the browser and make sure there isn't anything weird in your script that you don't see in your editor.
But yeah, this works perfectly fine for me with 1.8.3.min.js
Hello world!
$(document).ready(function() { $("p").click(function() { $("p").hide(); }); });Erg, the code block didn't work, but yeah, let me know what your source shows. Can you link to the actual site?
@taragrg : Remember that you need to close off your javascript resources with an ending script tag.
@JohnMotylJr is right. You need to close your script tag there. Like this:
Like this:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> // Put your code hereJust a couple of nitpicks, the below is the recommended way of writing jQuery.
yea i have ended the script on the next line ,I know the code is correct but why is this not working am not using IE i know it sucks
@taragrg : For some reason i believe it may be some kind of syntax error. I suggest you either: A.) Upload your page to a server and post the link for us to see. B.) Copy ALL of your code and go to this website to convert characters. Once converted, come back to this forum, paste your new code, and wrap said new code inside of pre and code tags.
The reason for this is so we can see exactly what you are doing because even though @SgtLegend have some great advice and @kevin11189 even gave you a working example, i believe you are missing something.
Better yet, validate your html with the W3C tool.
Yes it's a syntax error I believe Too.
John B
Thanks to all its working fine Thanks thanks thansk :) it was just a syntax error thanks JohnMotylJr