jquery – How to insert HTML markup in JS?

Question:

Hello everyone.

Tell me how to insert an HTML block with content in JS?

For instance:

<div class="ds">Текст текст</div><div class="sdf12">Текст текст</div>

<script type="text/javascript">
var as='<div class="ds">Текст текст</div><div class="sdf12">Текст текст</div>';

</script>

So for some reason it doesn’t work, but what’s the right way, so that later I connect this file and it reads the markup?

Answer:

http://jsfiddle.net/aqjLk2yk/

http://jquery-docs.ru/attributes/html/

http://jquery-docs.ru/attributes/text/

Scroll to Top