What Is JQuery?
jQuery is a JavaScript library (i.e. written in JavaScript) designed to simplify the scripting of the DOM-API across all browsers (“write once/run everywhere”).
The jQuery library is used by more than 61 percent of the top 100,000 sites.
jQuery’s CDN serves about 20 terabytes of data on an average day (7 petabytes/year).
Learn jQuery
- Learn jQuery Basics at jQFundamentals.com.
- Bookmark the jQuery API docs to use as a reference.
- jQuery’s Relevancy – There and Back Again
Load the Latest Version of jQuery
Use this script element to load the latest from jQuery’s Content Delivery Network (CDN):
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
Replace .value, .innerHTML, and .src with jQuery Functions
.html(). Get the HTML contents of a container element.
.html(htmlString). Set the HTML contents of a container.$(“main”).html(“<p>Delta Echo Foxtrot</p>”); //set
console.log($(“main”).html()); //get
.val(). Get the value attribute of DOM elements, such as textboxes.
.val(value). Set the value of an element.$(“#outBox”).val(“Golf Hotel”); //set
console.log($(“#outBox”).val()); //get$(“#img2”).attr(“src”, “../images/img-name.png”); //set
Replace onclick with .on()
.on()
Description: Attach an event handler function for an event.
Example:
$(‘#btn1’).on(“click”, function(){ console.log(“clicked!”); })
Learn More jQuery
- jQuery Selectors (jQuery.com)
- Try jQuery (Code School)
Recent Comments