Search code examples
phpjquerywysiwygtext-editorbootstrap-wysiwyg

WYSIWYG Text Editor Not Triggering TextArea Text


I am using Responsive-WYSIWYG-Text-Editor-with-jQuery-Bootstrap-LineControl-Editor But when form is posted textarea value is null and one more thing i have used Required Attribute on TextArea But still form gets posted without entering text in textarea. Below is my code -

HTML CODE

<textarea name="Content" id="txtEditor" class="form-control" placeholder="Have a New Face To Slap! Post Here" maxlength=250 required></textarea>

Jquery Code

    //I am Enable TextEditor On TextArea Click
$(document).ready(function() {
        $("#txtEditor").click(function(){
                $("#txtEditor").Editor();

        });

The Following Div Is Generated By WYSIWYG editor that holds the values entered in Textarea

<div class="Editor-editor" contenteditable="true" style="overflow: auto;">Text Area value&nbsp;</div>

Solution

  • I have not used WYSIWYG Editor But according to your problem i have a solution available for you .

    Solution : You Div With Class Editor-editor is having Value that you type in WYSIWYG Editor and you need to put that to your But yes we can easily do that using jquery class selector See Code Below -

    You Must Be having a Tag With Submit Button So We are trying to Copy Contents from To

    <button class="btn btn-primary pull-right" type="Submit" onclick=" $('#txtEditor').val($('.Editor-editor').text());">Post</button>
    

    And That is Enough Now Your On which you have placed WYSIWYG editor Will have Text that you typed in WYSIWYG Editor