What does append mean in jquery

青灯夜游
Release: 2022-03-10 17:11:40
Original
5332 people have browsed it

In jquery, append means "append", which is used to insert specified content at the end of the selected element; the syntax is "$(A).append(B)", which means going to the end of A Insert B content (can include HTML tags).

What does append mean in jquery

The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.

What does append mean in jquery

append means "append" and is a built-in method in jquery.

The append() method can insert specified content at the end of the selected element.

Syntax:

$(A).append(B)
Copy after login

means inserting B (can include HTML tags) at the end of A.

The content to be inserted can be:

  • HTML element

  • jQuery object

  • DOM element

Example:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<style type="text/css">
			p {
				background-color: orange;
			}
		</style>
		<script src="js/jquery-1.10.2.min.js"></script>
		<script>
			$(function () {
            $("#btn").click(function () {
                var $strong = "<strong>jQuery教程</strong>";
                $("p").append($strong);
            })
        })
    </script>
	</head>
	<body>
		<p>php中文网</p>
		<input id="btn" type="button" value="插入" />
	</body>
</html>
Copy after login

What does append mean in jquery

[Recommended learning:jQuery video tutorialwebfront-end video

The above is the detailed content of What does append mean in jquery. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template