Log in
updated 11:29 AM UTC, May 4, 2016

jQuery basics & CDN explained

  • Written by Madhu V Rao
  • Published in Javascripts

jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript.

jQuery also simplifies a lot of the complicated things from JavaScript, like AJAX calls and DOM manipulation.

The jQuery library contains the following features:

    HTML/DOM manipulation
    CSS manipulation
    HTML event methods
    Effects and animations

Advantages are it works across all types of browsers.

Best way to use jQuery is to include it from one of the Content Delivery Networks (Google CDN or Microsoft CDN).

To use jQuery from Google : add this code

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">

One big advantage of using the hosted jQuery from Google or Microsoft:

Many users already have downloaded jQuery from Google or Microsoft when visiting another site. As a result, it will be loaded from cache when they visit your site, which leads to faster loading time.
Also, most CDN's will make sure that once a user requests a file from it, it will be served from the server closest to them, which also leads to faster loading time.

jQuery Syntax

The jQuery syntax is tailor made for selecting HTML elements and perform some action on the element(s).
By default, jQuery uses "$" as a shortcut for "jQuery"

Basic syntax is: $(selector).action()

    A $ sign to define/access jQuery
    A (selector) to "query (or find)" HTML elements
    A jQuery action() to be performed on the element(s)

Powered by Bullraider.com
Follow Us on Twitter
Find Us on Facebook
Follow Us on Google
Follow Us on Pinterest