How to replace '<p>' with '<li>' in an array in jQuery?

Posted by Devyn on Stack Overflow See other posts from Stack Overflow or by Devyn
Published on 2010-03-30T08:00:27Z Indexed on 2010/03/30 8:03 UTC
Read the original article Hit count: 291

Filed under:

Hi, Let's say I have this

$(document).ready(function() {
   var array = $.makeArray($('p'));
   $(array).appendTo(document.body);
   });
});

<p>how</p>
<p>are</p>
<p>you</p>
<p>baby?</p>

If I want to replace <p> with <li> and expected output is ...

<li>how</li>
<li>are</li>
<li>you</li>
<li>baby?</li>

What should I do? Thanks in advance!

© Stack Overflow or respective owner

Related posts about jQuery