Saturday, October 18, 2014

Introduction

jQuery is a JavaScript library specialized for changing web page documents on the fly.

jQuery can change the web page from within the browser.

jQuery makes the DOM less scary. It is JavaScript, but a much more approachable version.

jQuery uses a selector engine. You ask for something with a selector, and the JavaScript interpreter asks the DOM to get it for you.

The JavaScript interpreter does not change the original HTML and CSS files. It makes changes to the DOM's representations of the page in the browser's memory.

Look into the browser


jQuery Function



jQuery selects elements the same way CSS does

CSS selectors select elements to add style to those elements; 
jQuery selectors select elements to add behaviour to those elements.

Element / tag selector 

$("h1").hide()

Class selector

$(".my_class").slideUp();

ID Selector

$("my_id").fadeOut();

ready




Pass in a "*" into the jQuery wrapper to get all the elements.

$(this) allows us to use jQuery methods to affect the current element.

Classing up your elements

In CSS, classes are used to group elements together and give them common style attributes.

Both CSS and jQuery use the "." to signify a class.

ID-entifying elements

An ID selector is used to identify a single, unique element on a page.


The problem caused by scripts is that they block parallel downloads in the browser.

Images from different servers can be downloaded more than two at a time, but once your browser encounters a <script> tag, it can no longer download multiple items in parallel. Having them at the bottom means it will help speed up your page load time.

Descendant Selectors




Wireup Pages



No comments:

Post a Comment