I need to find a form tag within an element and copy it. I feel I’m close but not quite there yet. He’s what I’ve got so far:
JS
if ($('#myElement').find('form').length > 0) {
var myFormTag= $('#myElement').find('form').html();
}
HTML
<div id="myElement">
<h1>
blah
</h1>
<form action="blah.php" method="post">
<table>
<tr>
<td>
<select>
<option>option
</select>
</td>
<td>
<input type="text">
</td>
</tr>
</table>
</form>
</div>
I just need to return the opening tag:
<form action="blah.php" method="post">
UPDATE:
DEMO
Result:
<form action="blah.php" method="post">