Started

Selectors

Utilities

Animation

AJAX

CSS

Event

Manipulation

Cookie

String

Attributes

Data

Storage

Miscellaneous

$require

Asynchronously load a script and css files.
$require( src, callback )
  1. src [string/array/object]
    The url of target script and css file.
  2. callback (optional) [function]
    The function will fired when all target resource are loaded.

Notes

The function to load script and css file asynchronously to increase the page loading performance. Yes, css files are supported.

Example

HTML code
<div id="message"></div>
<button onclick="start_load_jQuery()">Load files</button>
JavaScript code
function start_load_jQuery()
{
	// Load single
	// $require("http://code.jquery.com/jquery-2.0.2.min.js");

	// With array
	// $require([
	// 	"http://code.jquery.com/jquery-2.0.2.min.js",
	// 	"http://documentcloud.github.io/underscore/underscore-min.js"
	// ]);

	// With label
	$require({
		jquery: "http://code.jquery.com/jquery-2.0.2.min.js",
		underscore: "http://documentcloud.github.io/underscore/underscore-min.js"
	}, function ()
	{
		alert("jQuery is loaded. The version is " + $().jquery + "\nunderscore loaded. The version is " + _.VERSION);
	});
}
Demonstration