Reputation: 1863
We have some block. Ex:
<div class="block"></div>
and we want to add tag inside it, so, at the end it would seems like this:
<div class="block"><i></i></div>
How to do it with jQuery?
Upvotes: 1
Views: 110
Reputation: 548
Quick way is $('.block').append('<i></i>');
Although this add would add it all div with block classes.
You might need a unique id for a invidual div which would then be.
$('#block').append('');
Upvotes: 1
Reputation: 37771
Easy (:
$(".block").append("<i></i>");
or
$(".block").html("<i></i>");
or any of the dozens of DOM manipulators offered by jQuery
Upvotes: 2