short answer: Yes you can use wrap()
by default the $('.gap')
selector it look for .gap
class in your HTML, if it found it, it wrap it into li
element.
demo:
$('.gap').wrap('<li></li>')
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<span class="gap">...</span>
Note
dont use append() result will be
<span class="gap">...<li></li></span>
Edit:
anyway <span class="gap">...<li></li></span>
or <li><span class="gap">...</span></li>
both of them are not a valid HTML li
elements should be inside ul
element
please check these link, to undertand more about both of them append and wrap
3
solved Is it possible add html code using jquery or javascript? [closed]