Search code examples
javascriptjquerywysiwygjhtmlarea

Resize jHtml text area


I would like to resize jHtml TextArea just like normal text area , so is there any way for resizing.

Following is the code for creating jHtml Textarea.

Here is the HTML code:

<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>

and below is the javascript code :

<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>

Solution

  • you can achieve the behaviour by adding the "resizable" attribute of jHtmlarea. May it help you out.

    <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>