HTML () method append () method

.html () method?

1. Definition and Usage: html () method returns the contents of the selected element, i.e., the parameter is not provided in parentheses.

                          If the set parameters, return to set the parameters of the content.

                          The parameters and contents cover all want to match the contents of the elements

                          Parameter may be a function, i.e., function (index, dcontent)

                                                                    - index Alternatively, receiver selector position index.

                                                                  - dcontent Alternatively, receiving a selection of the current contents.
 
                

2, a simple example: ① $ ( "p") html ( "AAA");.     

                                                The contents of all p tags becomes: AAA

                         ②   $("p").html(String);     

                                                The contents of all p tags changed: the contents of the String

                         ③   $("p").html(function(n){
                                    return  n;

                                });                                

                                                 P contents of the first label becomes: 0 

                                                 Contents of the second p label becomes: 1 and so on and so on.

                                                 The contents of all labels becomes p: n (0,1,2 ......), that is the order of the p tag has the index (0 to start)

www.w3school.com.cn/jquery/manipulation_html.asp


Source: https://blog.csdn.net/l358366885/article/details/79757987

Guess you like

Origin www.cnblogs.com/jsll/p/11878205.html