Notes for using the append (content) method in jquery
The append (content) function appends content to each matching element. You need to pay attention to the usage. For more information, see the following example.
For example, add HTML tags to all paragraphs.
HTML code:
The Code is as follows:
<P> I wowould like to say: </p>
JQuery code:
The Code is as follows:
$ ("P"). append ("<B> Hello </B> ");
Result:
[<P> I wowould like to say: <B> Hello </B> </p>]
It seems that there is nothing. It's normal. What if we try to append it in another way?
$ ("P"). append ("<B> ");
$ ("P"). append ("Hello </B> ");
Result:
[<P> I wowould like to say: <B> </B> Hello </p>]
The result is like this. Why?
When I call the append () function, it will automatically check whether the html content you added meets the standard. If yes, it will be added normally. If not, then it will automatically generate display that meets the so-called standards.