4
Explanation:
I have a <div>
parent containing two <div>
daughters, however I would like to insert a <table>
using javascript, between, that is, in the middle of these two <div>
daughters who already exist in <div>
father.
But mine <table>
is a string that contains the HTML code as value.
Code of my <table>
string:
var HTMLString = '<table id="teste"><tbody id="appender"><tr class="header"><td class="cod">Código</td> <td class="nome">Nome</td><td class="tipo">Cidade - Estado</td></tr></tbody></table>';
HTML of father and daughter div:
<div id=elementoPai>
<div id="fixedHeader_outer">
<div id="fixedHeader">conteudo</div>
</div>
<!-- quero que a HTMLString se transforme num html que apareça aqui no meio das duas -->
<div id="pnlOpcoes_outer">
<div id="pnlOpcoes">conteudo</div>
</div>
</div>
Example in Jsfiddle
Question:
How could I do this? I would like several solutions, citing the advantages and disadvantages of them, being able to use jQuery or not
Is it jQuery tag... is it or is it pure JS?
– utluiz
can be in jQuery too, but it is necessary ? is faster ? what is the usefulness of using jQuery in this context? is at your discretion but I accept
– Paulo Roberto Rosa
One advantage of jQuery, considering the answers, is a code line for four with pure JS.
– utluiz
@Pauloroberto, Javascript is always faster than jQuery, however it can be simpler to start working on different browsers with jQuery
– Sergio
jQuery is javascript, not another language. It’s so ugly that I’ve seen browser with jQuery pre-loaded, to get out faster.
– Gustavo Rodrigues