I had someone help me out earlier and they used this notation to insert a paragraph with jQuery. I haven't seen it before.
$('<p />', {'class': 'preview',text: 'Test'}).insertAfter($uls.eq(0));
Inserts:
<p class="preview">Test</p>
How do I modify this code to insert the following instead?
<div class="preview"><p>Test</p></div>
I've tried: $('<div />', {'class': 'preview',text: '<p>Test</p>'})
But it parses the <p>
tags as text.
try using html
instead of text
, something like this :
$('<div />', {'class': 'preview', html: '<p>Test</p>'})