jhtmlarea

How to set value dynamically in JHTMLarea


I have been struggling to set the value of JHTML Area. But no luck. Can anyone please help me out. I have read so many articles but i didn't find anything regarding it. I have also searched here and found one problem but have no solution with it.

Any help would be appreciated.

Thanks and regards,

Zeeshan


Solution

  • I have resolved it. Before calling the JHTMLArea method on textarea copy the value in the textarea first and then apply the htmlarea function.

    $("#txtNotes").val($('#hdnNotesDescription').val());
    
                $("#txtNotes").htmlarea(
                    {
                        // Override/Specify the Toolbar buttons to show
                        toolbar: ["bold", "italic", "underline", "link", "unlink", "orderedlist", "unorderedlist", "indent", "outdent", "justifyleft", "justifycenter", "justifyright"],
                        toolbarText: $.extend({}, jHtmlArea.defaultOptions.toolbarText,
                        {
                            "bold": "Bold",
                            "italic": "Italic",
                            "underline": "Under Line",
                            "link": "Hyperlink",
                            "unlink": "Remove Hyperlink",
                            "orderedlist": "Numbering",
                            "unorderedlist": "Bullets",
                            "indent": "Increase Indent",
                            "outdent": "Decrease Indent",
                            "justifyleft": "Align Text Left",
                            "justifycenter": "Center",
                            "justifyright": "Align Text Right"
                        }),
                        loaded:function(){                            
                        }
                    });