Home > Web Front-end > JS Tutorial > Things to note when using the append(content) method in jquery_jquery

Things to note when using the append(content) method in jquery_jquery

WBOY
Release: 2016-05-16 17:05:22
Original
967 people have browsed it

As the following example: Append some HTML tags to all paragraphs.

HTML code:

Copy code The code is as follows:

I would like to say:


jQuery code:

Copy code The code is as follows:

$("p") .append("Hello");

Result:

[

I would like to say: Hello

]

It seems like nothing, it’s normal. What if we add it in another way?

$("p").append("");

$("p").append("Hello");

Result:

[

I would like to say: Hello

]

The result is like this, why is it like this?

I think when the append() function is called, it will automatically detect whether the html content you added meets the standards. If it does, add it normally. If it does not, it will automatically generate what it calls the displayed as standard.

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