jquery insert a html block so it starts before the target and ends after the target - is this possib
- by Chris
Hi all,
I understand you can add insert blocks of html before and after a target using before(), insertBefore(), after() and insertAfter().
I tried to do something similar to this
<script type="text/javascript">
$(document).ready(function(){
$("p").before("<div class='myContainer'>");
$("p").after("</div>");
});
</script>
<p>paragraph</p>
But the inject seems to automatically create closing tags for me, is there a way around this?
Cheers