<small id='h3o6l'></small><noframes id='h3o6l'>

<tfoot id='h3o6l'></tfoot>

    <i id='h3o6l'><tr id='h3o6l'><dt id='h3o6l'><q id='h3o6l'><span id='h3o6l'><b id='h3o6l'><form id='h3o6l'><ins id='h3o6l'></ins><ul id='h3o6l'></ul><sub id='h3o6l'></sub></form><legend id='h3o6l'></legend><bdo id='h3o6l'><pre id='h3o6l'><center id='h3o6l'></center></pre></bdo></b><th id='h3o6l'></th></span></q></dt></tr></i><div id='h3o6l'><tfoot id='h3o6l'></tfoot><dl id='h3o6l'><fieldset id='h3o6l'></fieldset></dl></div>
      • <bdo id='h3o6l'></bdo><ul id='h3o6l'></ul>
    1. <legend id='h3o6l'><style id='h3o6l'><dir id='h3o6l'><q id='h3o6l'></q></dir></style></legend>

        从 contentEditable div 中删除格式

        时间:2023-05-30
        <legend id='aJuNh'><style id='aJuNh'><dir id='aJuNh'><q id='aJuNh'></q></dir></style></legend>
        <i id='aJuNh'><tr id='aJuNh'><dt id='aJuNh'><q id='aJuNh'><span id='aJuNh'><b id='aJuNh'><form id='aJuNh'><ins id='aJuNh'></ins><ul id='aJuNh'></ul><sub id='aJuNh'></sub></form><legend id='aJuNh'></legend><bdo id='aJuNh'><pre id='aJuNh'><center id='aJuNh'></center></pre></bdo></b><th id='aJuNh'></th></span></q></dt></tr></i><div id='aJuNh'><tfoot id='aJuNh'></tfoot><dl id='aJuNh'><fieldset id='aJuNh'></fieldset></dl></div>
      1. <tfoot id='aJuNh'></tfoot>
      2. <small id='aJuNh'></small><noframes id='aJuNh'>

            <bdo id='aJuNh'></bdo><ul id='aJuNh'></ul>

                <tbody id='aJuNh'></tbody>

                • 本文介绍了从 contentEditable div 中删除格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我有一个 contentEditable Div,我想删除任何格式,尤其是复制和粘贴文本.

                  I have a contentEditable Div and I want remove any formatting especially for copy and paste text.

                  推荐答案

                  你试过使用innerText吗?

                  Have you tried using innerText?

                  添加:

                  如果您想从粘贴到可编辑 div 的内容中去除标记,请尝试创建临时 div 的旧技巧 - 请参见下面的示例.

                  If you want to strip markup from content pasted into the editable div, try the old hack of creating a temporary div -- see example below.

                  <!DOCTYPE html>
                  <html>
                  
                  <head> 
                    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
                    <title>Strip editable div markup</title>
                  
                    <script type="text/javascript">
                      function strip(html) {
                        var tempDiv = document.createElement("DIV");
                        tempDiv.innerHTML = html;
                        return tempDiv.innerText;
                      }
                    </script>
                  </head>
                  
                  <body>
                    <div id="editableDiv" contentEditable="true"></div>
                    <input type="button" value="press" onclick="alert(strip(document.getElementById('editableDiv').innerText));" />
                  </body>
                  
                  </html>
                  

                  这篇关于从 contentEditable div 中删除格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:格式化此 JavaScript 行 下一篇:在 &lt;head&gt; 中动态添加链接样式表

                  相关文章

                  最新文章

                  <legend id='fZgYw'><style id='fZgYw'><dir id='fZgYw'><q id='fZgYw'></q></dir></style></legend>
                  <i id='fZgYw'><tr id='fZgYw'><dt id='fZgYw'><q id='fZgYw'><span id='fZgYw'><b id='fZgYw'><form id='fZgYw'><ins id='fZgYw'></ins><ul id='fZgYw'></ul><sub id='fZgYw'></sub></form><legend id='fZgYw'></legend><bdo id='fZgYw'><pre id='fZgYw'><center id='fZgYw'></center></pre></bdo></b><th id='fZgYw'></th></span></q></dt></tr></i><div id='fZgYw'><tfoot id='fZgYw'></tfoot><dl id='fZgYw'><fieldset id='fZgYw'></fieldset></dl></div>
                  <tfoot id='fZgYw'></tfoot>
                  1. <small id='fZgYw'></small><noframes id='fZgYw'>

                        <bdo id='fZgYw'></bdo><ul id='fZgYw'></ul>