jQuery and Other Third-Party Libraries - HTML5 APPLICATIONS DEVELOPMENT MANUAL (2016)

HTML5 APPLICATIONS DEVELOPMENT MANUAL (2016)

21 - jQuery and Other Third-Party Libraries

JavaScript Libraries

The most effective programmers know how to make good use of what others write. A programming library contains snippets of code, subroutines, classes, and other resources you can re-use to create software. There are many JavaScript libraries available, and jQuery is one of the most popular.

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta charset="utf-8" />

<title>First use of jQuery</title>

<script type="text/javascript"

src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.5.js"></script>

<script type="text/javascript">

//Once the HTML document loads, execute the function within ready().

$(document).ready(function () {

//Each paragraph receives a "click" action, hide that particular paragraph.

$("p").click(function () {

$(this).hide();

});

});

</script>

</head>

<body>

<p>

This is the first paragraph. Click on me to make me

disappear.

<p>This is the second paragraph.

<p>This is the third paragraph.

</body>

</html>