Make editable div that sends post data on enter

20:51:00 , 0 Comments

make-editable-div-that-sends-post-data-on-enter
Hi there, to make editable div element we’re using jQuery for this tutorial.

HTML Markup

Lets create a div element
It is a basic form with a div that holds the id of edit and name of edit.

JQuery

Before using jQuery don’t forget to include jQuery library.
Below code makes a div editable:

Submit form on enter

We’ve created a editable div. Now we need to send the data in this div field on press of enter key.

jQuery

We’re actually getting the inner html of the div with the id of edit and appending a new hidden text input to the form and the submitting the form so now the post array will have a new variable with the name of edit.

Showing the result

you can use php echo to export the post variable
You’re done. Now little tweak with CSS will give you a nice output. See you in next post.

0 comments :