Possible Duplicate:
Using .after() to add html closing and open tags
I am in need of adding some HTML before a <li> and after the same <li>.
The selector works, but when it adds the HTML it also closes the <div>s with adding </div>. I need it to be open.
my code:
$('#ja-megamenu .level1').before('<div class="childcontent cols1 ">');
NOTE:
I need it to add ONLY <div class="childcontent cols1 "> before the li (with class=”level1″)
then later I’ll use:
$('#ja-megamenu .level1').after('</div>');
to add the closing </div>
This code doesn’t work. How can I get this to work?
Have been reading documentation all day long, but haven’t found the answer yet…
Thank you 🙂
Though this HTML is not valid (
<li>‘s parent could not be<div>), you may usewrap():