1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Using jQuery in Javascript

Discussion in 'jQuery' started by macdonjo, Sep 14, 2014.

  1. #1
    Code: http://codepen.io/mjau-mjau/pen/yDKBh/

    What is the "jQuery" keyword at the end of the first function on line 142...
    }(jQuery, this, this.document));


    I think my javascript isn't working because this variable is undefined. What am I supposed to do with this?
     
    macdonjo, Sep 14, 2014 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #2
    The code you are demo'ing has

    // mtree.js
    // Requires jquery.js and velocity.js (optional but recommended).

    which means you need to have the jquery library uploaded and linked - and you should have velocity too

    jquery is an amazing library that makes working with javascript much easier for those who dip in and out of the code. Arguably it slows down load times, is bloated etc but it has become an industry mainstay.
     
    sarahk, Sep 14, 2014 IP