<form id="form1">
<ul>
<li>Content</li>
<li>Content</li>
<li>Content</li>
</ul>
<input type="submit" value="Submit" />
</form>
I want to send the content in the ul tag when clicking the submit button.
the submitted data should be
<li>Content</li>
<li>Content</li>
<li>Content</li>
How would I write this in jquery and with proper char. escaping for the <>’s
Disclaimer: This is an alternative to my other AJAX based answer.
You can do this by setting the value of a hidden field with javascript. Also, your form needs an “action” attribute – it has to be submitted to somewhere.
The script:
The form will submit, and the hidden field will have the escaped HTML from the
<ul></ul>tag as value.