text area instead of div for bootstrap wysiwyg toolbar

1.3k views Asked by At

UPDATE

Maybe an easier way to put this would be "How can I submit the content that is typed into the <div> along with a <form> to send it to a database?

END UPDATE

I am using bootstrap wysiwyg and have found that it only works when your typing area is a <div> like this:

<div id="editor" contenteditable="true">
   Start Typing...
</div>

and it won't work with a text area like so:

<textarea cols="" rows="5" id="editor" contenteditable="true">
  Start Typing...
</textarea>

The full javascript code is below although I'm really not sure where the problem lies as the toolbar uses a data-target='#editor'

Click here to go to the github for full code, I just copied and pasted this into a separate js file.

1

There are 1 answers

1
Yuriy Galanter On

To answer your update: you will have to copy your DIV content into a form's hidden field in client code prior to form submission. Only content of Input/Textarea elements is sent in GET/POST.