Jump to content

JQuery: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
No edit summary
Line 42: Line 42:
</source>
</source>


Jquery can also be accessed, loaded, and run just as JavaScript has always been<ref>[http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery online Jquery Tutuorial]</ref>:
jQuery can also be accessed, loaded, and run just as JavaScript has always been<ref>[http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery online jQuery Tutuorial]</ref>:
<source lang=html4strict>
<source lang=html4strict>
<script type="text/javascript" src="jQuery.js"></script>
<script type="text/javascript" src="jQuery.js"></script>

Revision as of 20:59, 8 October 2009

jQuery
Developer(s)jQuery Team
Stable release
1.3.2 / February 20, 2009 (2009-02-20)
Repository
Written inJavaScript
TypeWeb application framework
LicenseDual license:
GPL and MIT
Websitehttp://jquery.com/

jQuery is a lightweight JavaScript library that emphasizes interaction between JavaScript and HTML. It was released in January 2006 at BarCamp NYC by John Resig.

jQuery is free, open source software Dual-licensed under the MIT License and the GNU General Public License.

Microsoft and Nokia have announced plans to bundle jQuery on their platforms,[1] Microsoft adopting it initially within Visual Studio[2] for use within Microsoft's ASP.NET AJAX framework and ASP.NET MVC Framework whilst Nokia will integrate it into their Web Run-Time platform.

Features

jQuery contains the following features:

  • DOM element selections using the cross-browser open source selector engine Sizzle, a spin-off out of jQuery project[3]
  • DOM traversal and modification (including support for CSS 1-3 and basic XPath)
  • Events
  • CSS manipulation
  • Effects and animations
  • Ajax
  • Extensibility
  • Utilities - such as browser version and the each function.

Use

jQuery usually exists as a single JavaScript file, containing all the common DOM, Event, Effects, and Ajax functions. It can be included within a web page using the following mark-up:

<script type="application/javascript" src="jQuery.js"></script>

jQuery can also be accessed, loaded, and run just as JavaScript has always been[4]:

<script type="text/javascript" src="jQuery.js"></script>


jQuery can also be loaded using the Google AJAX Libraries API with the following mark-up[5]:

<script type="application/javascript" src="http://www.google.com/jsapi"></script>
<script>
google.load("jquery", "1.3.2");
</script>

jQuery has two styles of interaction:

  • via the $ function, which is a factory method for the jQuery object. These functions, often called commands, are chainable; they each return the jQuery object
  • via $.-prefixed functions. These are utility functions which do not work on the jQuery object per se.

A typical workflow for manipulation of multiple DOM nodes begins with the $ function being called with a CSS selector string, which results in the jQuery object referencing zero or more elements in the HTML page. This node set can be manipulated by applying instance methods to the jQuery object, or the nodes themselves can be manipulated. For example:

$("div.test").add("p.quote").addClass("blue").slideDown("slow");

...finds the union of all div tags with class attribute test and all p tags with CSS class attribute quote, adds the class attribute blue to each matched element, and then slides them down with an animation. The $ and add functions affect the matched set, while the addClass and slideDown affect the referenced nodes.

The methods prefixed with $. are convenience methods or affect global properties and behaviour. For example, the following is an example of the map function called each in jQuery:

$.each([1,2,3], function() {
  document.write(this + 1);
});

... writes the numbers 234 to the document.

It is possible to perform browser-independent Ajax queries using $.ajax and associated methods to load and manipulate remote data.

$.ajax({
  type: "POST",
  url: "some.php",
  data: "name=John&location=Boston",
  success: function(msg){
    alert( "Data Saved: " + msg );
  }
});

... will request some.php from the server with parameters name=John and location=Boston and when the request is finished successfully, the success function will be called to alert the user.

Release history

Release date Version number Additional notes
June 30, 2006 1.0a Alpha Release
August 26, 2006 1.0 First Stable Release
August 31, 2006 1.0.1
October 9, 2006 1.0.2
October 27, 2006 1.0.3
December 12, 2006 1.0.4 Last 1.0 bug fix
January 8, 2007 1.1a Alpha Release
January 14, 2007 1.1
January 22, 2007 1.1.1
February 27, 2007 1.1.2
May 20, 2007 1.1.3a Alpha Release
July 1, 2007 1.1.3
July 5, 2007 1.1.3.1
August 24, 2007 1.1.4
September 10, 2007 1.2
September 16, 2007 1.2.1
January 15, 2008 1.2.2
February 8, 2008 1.2.3
May 19, 2008 1.2.4
May 21, 2008 1.2.5 Fix for bad build of 1.2.4
May 24, 2008 1.2.6
January 14, 2009 1.3 Sizzle Selector Engine introduced into core
January 21, 2009 1.3.1
February 20, 2009 1.3.2
December 2009/January 2010 1.4.0 John Resig will push for 1.4 release before the end of 2009, or early January 2010 at the latest.

See also

Template:Fossportal

Notes

  1. ^ Resig, John (2008-09-28). "jQuery, Microsoft, and Nokia". jQuery Blog. jQuery. Retrieved 2009-01-29.
  2. ^ Guthrie, Scott (2008-09-28). "jQuery and Microsoft". ScottGu's Blog. Retrieved 2009-01-29.
  3. ^ Resig, John (2009-01-14). "jQuery 1.3 and the jQuery Foundation". jQuery Blog. Retrieved 2009-05-04.
  4. ^ online jQuery Tutuorial
  5. ^ http://code.google.com/apis/ajaxlibs/documentation/#jquery

References

Bibliography