jQuery Learning-Style (1): How to cite jQuery

There are two ways to reference jQuery:

  • Refer to the external link
  • Reference local files

Original link of this article: https://blog.csdn.net/xzk9381/article/details/111687826

One, refer to external links

To refer to external links, first go to the jQuery official website, find the uncompressed version of jQuery, and copy the content given in the pop-up box to HTML:

<!DOCTYPE html>
<html>
<head>
	<title></title>
	<script src="http://code.jquery.com/jquery-1.12.4.js" integrity="sha256-Qw82+bXyGq6MydymqBxNPYTaUXXq7c8v3CwiYwLLNXU="
  crossorigin="anonymous"></script>
</head>
<body>
	<script type="text/javascript">
		console.log($)
	</script>
</body>
</html>

Print the $ symbol in JS to test whether jQuery is successfully referenced.

Two, reference local files

You can also save this jQuery file locally, and then reference it in the following way:

<!DOCTYPE html>
<html>
<head>
	<title></title>
	<script src="jquery-1.12.4.js">
	</script>
</head>
<body>
	<script type="text/javascript">
		console.log($)
	</script>
</body>
</html>

Original link of this article: https://blog.csdn.net/xzk9381/article/details/111687826

Guess you like

Origin blog.csdn.net/xzk9381/article/details/111687826