1

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?

3 Answers 3

2

Easy (:

$(".block").append("<i></i>");

or

$(".block").html("<i></i>");

or any of the dozens of DOM manipulators offered by jQuery

Sign up to request clarification or add additional context in comments.

Comments

1
$('.block').append('<i></i>');

Comments

1

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('');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.