Difference between revisions of "JQuery"
MargeryLeddy (Talk | contribs) |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | '''jQuery''' is a [[JavaScript]] library that simplifies [[HTML]] document traversing, event handling, animating, and [[ | + | '''jQuery''' is a [[JavaScript]] library that simplifies [[HTML]] document traversing, event handling, animating, and [[AJAX]] interactions. |
==Example== | ==Example== | ||
Line 18: | Line 18: | ||
* [http://jquery.com/ jQuery Homepage] | * [http://jquery.com/ jQuery Homepage] | ||
+ | |||
+ | {{programming}}{{social}} |
Latest revision as of 10:07, 2 May 2012
jQuery is a JavaScript library that simplifies HTML document traversing, event handling, animating, and AJAX interactions.
Example
Here is an example piece of code written in jQuery:
$('div.container').html('hello world');
$('div.container')
This is a selector which is selecting all div's with the class name container. The period (.) that detonates them means that you want to select the div with the class name container. You can use as hash mark (#) to select the div containing the id container as well.
.html('hello world')
Because you have selected your element, now you will have to do something with it. In this case, you would be using the html function. Every function takes in different parameters to utilize different functionalities; in this case, if you specify a first argument for the html function ('hello world'), you will change the contents of the inner HTML of the selected element. If you wanted to just get the contents of the inner HTML (the data between the <div> tags), you would simply call the html function without any arguments.