How we can get the content present in contentEditable in html format in PHP
For example i have this code and want to get its value in a variable in PHP:
<div contentEditable="true"> type here
<img src="http://t2.gstatic.com/images?q=tbn:ANd9GcQCze-mfukcuvzKk7Ilj2zQ0CS6PbOkq7ZhRInnNd1Yz3TQzU4e&t=1" /></div>
because i want to use this as html body for an email.
Infact i want to get the value of contentEditable and save it into a variable and then use that variable as a body for my email. Any idea how to perform this task.
You’ll need to store the contents of the element in a form element so it can be submitted to your PHP page.
I assume you want
contenteditableinstead oftextareafor rich text… consider taking a look at WYSIWYG editors like TinyMCE instead.If you still want to stick with your current method, you’ll need some JS to copy the value of the div into a hidden form element before the page gets submitted.
HTML
jQuery
DEMO