2
How to create elements with jQuery
?
I’ll try to explain...
I have 2 screens, card registration and card display.
For each registered card, I send it to the server and enter it in the internal database. So far so good.
Only for every card registered, I need to, too, go populating my html
card display.
He gets like this:
The code of the image above is this:
<div class="row corpo-cartoes">
<div class="col s12 m7" style="width: 100%;">
<div class="card">
<div class="card-image">
<img src="img/apresentacao.jpg">
<span class="card-title">Card Title</span>
</div>
<div class="card-action icone-meu-cartao">
<a href="#" ><i class="material-icons">code</i></a>
<a href="#"><i class="material-icons">crop_free</i></a>
<a href="#"><i class="material-icons">visibility</i></a>
<a href="#"><i class="material-icons btn-editar">edit</i></a>
</div>
</div>
</div>
</div>
My question is:
How do I create the above code with jQuery
to populate on the card display for each registered card?
Or have a better way of doing it?
With jQuery you can do:
$('#elementoAlvo').html('<p>Meu elemento</p>');
or, considering that you will have several "cards", you can do.appendTo()
, jQuery! Documentation: http://api.jquery.com/appendto/– LipESprY