I am making a layout or design of the body of an editor, instead of using a textarea
I am using a DIV
that works the same as a textarea
.
The following DIV
inserts html code as simple content.
<div id="editor" class="editor"contenteditable></div>
How can I save the data contained in that div
to the database.
Well, since in your comment you are telling me that you use Jquery, I will show you how you could obtain its value:
If you look if you want to get the text you use the .text() or if it is the html content you use .html() , in the click event that I did it is where you do your ajax but the idea of obtaining the values is there, then your database, depending on which one, would use a data type to let you store large amounts of text in html, in oracle, for example, the data type of the field would be BLOB , I hope it works for you.
You must receive the content of the div with
jQuery
html since it.val()
will not work for you.What do you want to pass directly just the text without the html? Just ask for the text:
Try to see ;)
How about my question is very similar and when I get the text, I can use txt as a variable of _post["txt"] to be able to store the text in a host database column? Thank you