Home >Web Front-end >JS Tutorial >Things to note when using the append(content) method in jquery_jquery
As the following example: Append some HTML tags to all paragraphs.
HTML code:
I would like to say:
jQuery code:
[
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.