mercredi 30 mars 2016

Creating an element in an element with Jquery

I'm trying to create an element with an element inside of it in JQuery, but I'm not getting anything when I try and output it.

This is the HTML equivalent of what I'm looking for:

HTML:

<div class="btn-icn">
<button class="btn"><span class="glyphicon glyphicon-comment"></span>
</button></div>

Jquery:

a = $(button).attr({
class: "btn";
id:"btn";
}.append($(icon).attr({
class:"glyphicon glyphicon-comment";
id="comment";
}));
)

alert(a);

Thanks!




Aucun commentaire:

Enregistrer un commentaire