Home  >  Article  >  Web Front-end  >  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
WBOYOriginal
2016-05-16 17:05:22919browse

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.

Statement:
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