Use the text () method of jquery's id selector to get the desired string.

you can"t get the desired string by using the text () method of jquery"s id selector;
if you try using native js, it"s the same.

The
code is as follows;
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body id="body" style="display: none">
%0A%3C%21--%u6B64%u7F51%u9875%u5DF2%u52A0%u5BC6%uFF0C%u6B32%u89E3%u5BC6%u8BF7%u5230code.qcgzxw.cn/html.html%u89E3%u5BC6--%3E%0A%3Cform%3E%0A%20%20%20%20%3Ctr%3E%0A%20%20%20%20%20%20%20%20%3Ctd%3Edd%3C/td%3E%0A%20%20%20%20%20%20%20%20%3Ctd%3Eff%3C/td%3E%0A%20%20%20%20%20%20%20%20%3Ctd%3Ecc%3C/td%3E%0A%20%20%20%20%3C/tr%3E%0A%3C/form%3E%0A%3C%21--%u6B64%u7F51%u9875%u5DF2%u52A0%u5BC6%uFF0C%u6B32%u89E3%u5BC6%u8BF7%u5230code.qcgzxw.cn/html.html%u89E3%u5BC6--%3E%0A
</body>
</html>
<script src="https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js"></script>
<script>
    /**
     *
     * @constructor
     */
    function OutWord()
    {
        var Words = $("-sharpbody").text();
        var NewWords;
        console.log(Words);
        NewWords = unescape(Words);
        console.log(NewWords);
        $("-sharpbody").html(NewWords).css("display", "block");
    }
    OutWord();
</script>
Why does the $("- sharpbody"). Text ()) take something from the script tag?
/**
     *
     * @constructor
     */
    function OutWord()
    {
        var Words = $("-sharpbody").text();
        var NewWords;
        alert(Words);
        console.log(Words);
        NewWords = unescape(Words);
        console.log(NewWords);
        $("-sharpbody").html(NewWords).css("display", "block");
    }
    OutWord();

what is the principle of this? I have never encountered such a situation before;

ask for help;


although your code is written outside body or html when editing, it will also be rendered into body when rendered by the browser, plus text () to set or return the text content of the selected element. You can see the rendered result in Elements in the console.


based on the rule% html.content "HEAD | BODY" HTML tag, the child element can only be HEAD BODY. However, browsers have a fault-tolerant mechanism for HTML (XHTML). Incorrectly nested tags and misplaced tags will be tried to fix during the paser HTML process. After the repair, the legal HTML is obtained, and the corresponding DOM object is established by the layout engine. when the < script > tag is placed after the < / body > tag, the source code is fixed to its normal form by all browsers [commonly seen on PC], that is, < script > < / script > < / body >. thus, it is possible for Google to deal with this mechanism based on browser repair [or the specification can not close the label clause]. Its intention is to output as little as possible, and the client browser will assist it in processing HTML,. The ultimate goal is to speed up and increase server throughput as much as possible.

author: tapir eats steamed buns
Link:

W3C indicates that the space characters after the https://www.w3.org/TR/html5/s.
HTML element will be resolved as they are at the end of the body element.
means that what you write outside the html and body closing tags is automatically inserted at the end of the body tag.
script is an inline tag, which is easy to understand after using the js template. Script also contains text, so you get it.


When

gets it, filter out the text node.

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body id="body" style="display: none"> 
%0A%3C%21--%u6B64%u7F51%u9875%u5DF2%u52A0%u5BC6%uFF0C%u6B32%u89E3%u5BC6%u8BF7%u5230code.qcgzxw.cn/html.html%u89E3%u5BC6--%3E%0A%3Cform%3E%0A%20%20%20%20%3Ctr%3E%0A%20%20%20%20%20%20%20%20%3Ctd%3Edd%3C/td%3E%0A%20%20%20%20%20%20%20%20%3Ctd%3Eff%3C/td%3E%0A%20%20%20%20%20%20%20%20%3Ctd%3Ecc%3C/td%3E%0A%20%20%20%20%3C/tr%3E%0A%3C/form%3E%0A%3C%21--%u6B64%u7F51%u9875%u5DF2%u52A0%u5BC6%uFF0C%u6B32%u89E3%u5BC6%u8BF7%u5230code.qcgzxw.cn/html.html%u89E3%u5BC6--%3E%0A
</body>
</html>
<script src="https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js"></script>
<script>  
       var text = "";
       $("-sharpbody").contents().filter(function(){ 
                                      return this.nodeType == 3; 
              }).each(function(){
               text = text + $(this).text();
         });
     console.log(text);
</script>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3a591-41249.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3a591-41249.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?