I have a simple list (ul>li
) which is manipulated with jQuery UI in a custom meta box.
How would I go about saving the contents of the list during post save?
I already have the save function ready, but how do I get the HTML data into PHP so I can put it in the database with update_post_meta
?
The list looks like (with class names etc):
<ul>
<li>Text 1</li>
<li>Text 2</li>
<li>Text 3</li>
</ul>
‘Text 1, Text 2, Text 3’ would be saved.
This can be done with a hidden input field. Make jQuery reflect the contents of the visible list into the hidden field.
Update the meta data using this field and build the initial list based on its values.