Difference between revisions of "JQuery"

From Media Design: Networked & Lens-Based wiki
Jump to navigation Jump to search
Line 4: Line 4:
 
<source lang="javascript">
 
<source lang="javascript">
 
$("a").hide();
 
$("a").hide();
 +
</source>
 +
 +
Or to make all paragraphs of class "side" have a pink background:
 +
<source lang="javascript">
 +
$("p.side").css({background:  "pink"});
 
</source>
 
</source>
  

Revision as of 15:43, 26 July 2009

JQuery is a JavaScript popular framework. It smooths over many of the difficulties that traditionally made JavaScript hard to work with and supports / encourages a unique style of coding driven by CSS-selector based "queries". JQuery code can be surprisingly compact.

For example, to hide all the links (in anchor tags) on a page, you could simply write:

$("a").hide();

Or to make all paragraphs of class "side" have a pink background:

$("p.side").css({background:  "pink"});

http://jquery.org