<ul class="name-email-list">
<li>xxxx<strong> tttttt</strong><a href="#." class="icon-close"></a></li>
</ul>
.appendTo()
jQuery documentation
First get your content and append it to some element:
$("<li>WhateverContent</li>").appendTo(".name-email-list");
.append()
jQuery documentation
First get some element and append it your content:
$(".name-email-list").append("<li>WhateverContent</li>");
As you can see either of them can be used. They work the opposite way. Use the one that's easier to understand.
$('.name-email-list').append('<li>New li </li>')
You could use the .append()
method:
$('ul.name-email-list').append('<li>xxxx<strong> tttttt</strong><a href="#." class="icon-close"></a></li>');
Use the append function:
$('ul.name-email-list').append('<li>xxxx<strong> tttttt</strong><a href="#." class="icon-close"></a></li>');
But beware, that you need to reference your ul in a way, that only the targeted ul is selected. e.g. by ensuring, that only one ul has this class, or by giving the ul an id.
精彩评论