Jess McKenzie
Jess McKenzie

Reputation: 8385

HTML5 ContentEditable

I have a few questions regarding HTML5 ContentEditable and PHP, I would be very happy if you could provide me with examples of what I am trying to do so I can get an idea.

Upvotes: 2

Views: 4327

Answers (1)

blacktarmac
blacktarmac

Reputation: 177

How would I save content that is changed in HTML5 ContentEditable?

Assuming that you have a div that's contentEditable, like:

<div id="content" contentEditable="true">here goes your contenteditable content</div>

After you've finished editing (like when you're clicking the save-button) you have to do something like this (with jQuery):

<script type="text/javascript">
$.post('save.php', {
    content : $('#content').html()
}
</script>

You'd then receive a post request with you save.php script. You can access the posted data using $_POST['content'];

Upvotes: 6

Related Questions