编程语言
首页 > 编程语言> > javascript-调整jHtml文本区域的大小

javascript-调整jHtml文本区域的大小

作者:互联网

我想像普通的text area一样调整jHtml TextArea的大小,所以有什么方法可以调整大小.

以下是用于创建jHtml Textarea的代码.

这是HTML代码:

<table style="width: 100%; border-collapse: separate !important; border-spacing: 2px!important">
<tr>
    <td>
        <%=Html.LabelFor(m => m.Description)%>
    </td>
    <td>
        <%=Html.TextAreaFor(m => m.Description, new { @class="form-control",style="width: 610px; height: 150px" })%>
    </td>
</tr>
</table>

以下是javascript代码:

<script type="text/javascript">
   $(function () {
    $("#Description").htmlarea({
        // Override/Specify the Toolbar buttons to show
        toolbar: [
            ["bold", "italic", "underline", "|", "forecolor"],
             ["p", "h3", "h4", "h5", "h6"],
              ["link", "unlink", "|", "image"],
              ["orderedlist", "unorderedlist"],
              ["increasefontsize", "decreasefontsize"],
              ["indent", "outdent"],
              ["justifyleft", "justifycenter", "justifyright"],
              ["cut", "copy", "paste"]
        ]
    });
});
</script>

解决方法:

您可以通过添加jHtmlarea的“可调整大小”属性来实现此行为.希望它能帮到您.

<script type="text/javascript">
   $(function () {
     $("#Description").htmlarea({           
          toolbar: [
             ["bold", "italic", "underline", "|", "forecolor"],
             ["p", "h3", "h4", "h5", "h6"],
             ["link", "unlink", "|", "image"],
             ["orderedlist", "unorderedlist"],
             ["increasefontsize", "decreasefontsize"],
             ["indent", "outdent"],
             ["justifyleft", "justifycenter", "justifyright"],
             ["cut", "copy", "paste"]
         ]
     }).parent().resizable({ alsoResize: $("#comm").find('iframe') });
  });
</script>

标签:wysiwyg,javascript,jquery,jhtmlarea
来源: https://codeday.me/bug/20191119/2033186.html