The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Programming Fundamentals" Dec 02 - 2:00 PM Eastern

my basic jquery not working

  • # December 19, 2012 at 10:35 pm

    < !doctype html>

    Hi friends click me to hide

    this is the code and its not working i am using the CDN instead of local jquery and why is it not working thanks

    # December 19, 2012 at 10:44 pm

    It’s working for me….

    # December 19, 2012 at 10:54 pm

    yea its working in your framework kevin11189 but its not working in my browser dont know why

    # December 19, 2012 at 11:11 pm

    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.

    # December 19, 2012 at 11:13 pm

    But yeah, this works perfectly fine for me with 1.8.3.min.js

    Hello world!

    # December 19, 2012 at 11:15 pm

    Erg, the code block didn’t work, but yeah, let me know what your source shows. Can you link to the actual site?

    # December 20, 2012 at 2:00 am

    @taragrg : Remember that you need to close off your javascript resources with an ending script tag.

    <script src=""></script>
    # December 20, 2012 at 3:41 am

    @JohnMotylJr is right. You need to close your script tag there.
    Like this:

    <script src=""></script>

    # December 20, 2012 at 3:45 am

    @JohnMotylJr is right. You need to close your script tag there.
    Like this:
    <script src=""></script>

    # December 20, 2012 at 6:54 am

    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

    # December 20, 2012 at 7:36 am

    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

    # December 20, 2012 at 2:26 pm

    @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.

    # December 20, 2012 at 3:07 pm

    Yes it’s a syntax error I believe Too.

    John B

    # December 20, 2012 at 3:11 pm

    # December 21, 2012 at 3:43 am

    Thanks to all its working fine Thanks thanks thansk :) it was just a syntax error thanks JohnMotylJr

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed