How to replace "<p>" with "<li>" in an array in jQuery?
Say I have it
$(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 the expected result will be ...
<li>how</li>
<li>are</li>
<li>you</li>
<li>baby?</li>
What should I do? Thanks in advance!
+3
2 answers