国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

jQuery tag contains content actions

Tags contain content operations

Use javascript operations:

  • dvnode.innerHTML Get the information contained in the div

  • dvnode.innerHTML = XXX; Set the content contained in the div

Note: innerHTML is not a w3c standard technology , many browsers only support it

Use jquery operation:

  • ##$().html(); // Get the information contained in the node

  • $().html(information); //Set the content contained in the node

  • $().text (); //Get the "text string information" content contained in the node

  • $().text(information); //Set the content contained in the node (if there is an html tag, just The "><" symbol becomes a symbol entity)

  • <!DOCTYPE html>
    <html>
        <head>
            <title>php.cn</title>
            <meta charset="utf-8" />
            <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
            <script>
               function f1(){
                alert($('div').html());
                alert($('div').text());
                }
                function f2(){
    
                    $('div').text("這里是php中文網(wǎng)");
                } 
            </script>
        </head>
        <body>
            <div>歡迎 <p>大家 <span>學(xué)習(xí)jQuery</span></p></div>
    
            <input type="button" value="獲取" onclick="f1()" />
            <input type="button" value="設(shè)置" onclick="f2()" /> 
        </body>
    </html>



##The difference between html() and text() methods :

##① Get content

The former can get html tags and ordinary string content

The latter only gets ordinary string content

② Set content

The former can set html tags and ordinary string content

The latter only sets ordinary string content. If there is tag tag content in the content, put the "< ;" ">" symbol is converted into a symbol entity<-----$lt; >----> Space------  

The above two operations (get /Settings) If the operation content is pure string content, the effect will be the same.

Continuing Learning
||
<!DOCTYPE html> <html> <head> <title>php.cn</title> <meta charset="utf-8" /> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> <script> function f1(){ alert($('div').html()); alert($('div').text()); } function f2(){ $('div').text("這里是php中文網(wǎng)"); } </script> </head> <body> <div>歡迎 <p>大家 <span>學(xué)習(xí)jQuery</span></p></div> <input type="button" value="獲取" onclick="f1()" /> <input type="button" value="設(shè)置" onclick="f2()" /> </body> </html>
submitReset Code