0
Good when I want to add an html to the page using jQuery
I do like this:
$("body").html('ddd');
But in this way I delete old content, it is possible to add html in Body without deleting page content?
0
Good when I want to add an html to the page using jQuery
I do like this:
$("body").html('ddd');
But in this way I delete old content, it is possible to add html in Body without deleting page content?
5
What you’re looking for is append, adds inside element after all:
$("body").append('ddd');
Or prepend which adds inside the element but first of all:
$("body").prepend('ddd');
Example:
$("body").append('<p>Eu vou para depois do conteudo do body</p>');
$("body").prepend('<p>Eu vou para antes do conteudo do body</p>');
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<h2>Eu vou estar no meio depois dos outros serem inseridos</h2>
Browser other questions tagged javascript jquery
You are not signed in. Login or sign up in order to post.
vlw thank you so much
– Hugo Borges