Jquery 从HTMLbox检索文本

Jquery 从HTMLbox检索文本,jquery,Jquery,有人知道如何从HTMLbox富文本编辑器中检索文本吗?只是一个扩展到html元素textarea的插件。您可以将其视为普通textarea html元素。 例如 要使用HtmlBox的内置函数,请执行以下操作: 将htmlbox的返回赋值给一个变量,然后使用该变量调用htmlbox的方法,例如hb_full.get_html;或任何其他方法。请参见下面的代码示例 <script type="text/javascript"> var hb_full; $(document).

有人知道如何从HTMLbox富文本编辑器中检索文本吗?

只是一个扩展到html元素textarea的插件。您可以将其视为普通textarea html元素。 例如


要使用HtmlBox的内置函数,请执行以下操作: 将htmlbox的返回赋值给一个变量,然后使用该变量调用htmlbox的方法,例如hb_full.get_html;或任何其他方法。请参见下面的代码示例

<script type="text/javascript">
    var hb_full;
$(document).ready(function(){
        hb_full = $("#htmlbox_full").css("height", "300").css("width", "100%").htmlbox({
            toolbars: [
                [
                    // Cut, Copy, Paste
                    "separator", "cut", "copy", "paste",
                    // Undo, Redo
                    "separator", "undo", "redo",
                    // Bold, Italic, Underline, Strikethrough, Sup, Sub
                    "separator", "bold", "italic", "underline", "strike", "sup", "sub",
                    // Left, Right, Center, Justify
                    "separator", "justify", "left", "center", "right",
                    // Ordered List, Unordered List, Indent, Outdent
                    "separator", "ol", "ul", "indent", "outdent",
                    // Hyperlink, Remove Hyperlink, Image
                    "separator", "link", "unlink", "image"
                ],
                [
                    // Show code
                    "separator", "code",
                            // Formats, Font size, Font family, Font color, Font, Background
                    "separator", "formats", "fontsize", "fontfamily",
                    "separator", "fontcolor", "highlight",
                ],
                [
                    //Strip tags
                    "separator", "removeformat", "striptags", "hr", "paragraph",
                    // Styles, Source code syntax buttons
                    "separator", "quote", "styles", "syntax"
                ]
            ],
            about: true, // "false" to hide About button
            idir: "./img/HtmlBoxImg/",
            icons: "default", //all options: "default", "silk"
            skin: "blue"      //all options: "silver", "blue", "green", "red"
        });
    });

    function getHtmlFromEditor()
    {
        var HtmlFromEditor = hb_full.get_html();
        alert(HtmlFromEditor);
    }
    </script>

    <textarea id="htmlbox_full"></textarea>
<button onclick="getHtmlFromEditor();">Display HTML</button>

如何在HTMLbox上处理javascript注入?
<script type="text/javascript">
    var hb_full;
$(document).ready(function(){
        hb_full = $("#htmlbox_full").css("height", "300").css("width", "100%").htmlbox({
            toolbars: [
                [
                    // Cut, Copy, Paste
                    "separator", "cut", "copy", "paste",
                    // Undo, Redo
                    "separator", "undo", "redo",
                    // Bold, Italic, Underline, Strikethrough, Sup, Sub
                    "separator", "bold", "italic", "underline", "strike", "sup", "sub",
                    // Left, Right, Center, Justify
                    "separator", "justify", "left", "center", "right",
                    // Ordered List, Unordered List, Indent, Outdent
                    "separator", "ol", "ul", "indent", "outdent",
                    // Hyperlink, Remove Hyperlink, Image
                    "separator", "link", "unlink", "image"
                ],
                [
                    // Show code
                    "separator", "code",
                            // Formats, Font size, Font family, Font color, Font, Background
                    "separator", "formats", "fontsize", "fontfamily",
                    "separator", "fontcolor", "highlight",
                ],
                [
                    //Strip tags
                    "separator", "removeformat", "striptags", "hr", "paragraph",
                    // Styles, Source code syntax buttons
                    "separator", "quote", "styles", "syntax"
                ]
            ],
            about: true, // "false" to hide About button
            idir: "./img/HtmlBoxImg/",
            icons: "default", //all options: "default", "silk"
            skin: "blue"      //all options: "silver", "blue", "green", "red"
        });
    });

    function getHtmlFromEditor()
    {
        var HtmlFromEditor = hb_full.get_html();
        alert(HtmlFromEditor);
    }
    </script>

    <textarea id="htmlbox_full"></textarea>
<button onclick="getHtmlFromEditor();">Display HTML</button>