I have a div where multiple fieldsets and just below hr :
Thedivcontentisdynamicandmayhave3ormorefieldsets.InmycodeIcouldonlygetthecontentthatisinsidethefirstone.HowcanIgetthewholefieldset?
Hereisthecodeformypage:
<html><head><title></title></head><body><h3>MultiplosFieldsets</h3><br><divid="BlocosDinamicos">
<fieldset><legend></legend>
<p>Conteudo 1</p>
</fieldset>
<fieldset><legend></legend>
<p>Conteudo 2</p>
</fieldset>
<fieldset><legend></legend>
<p>Conteudo 3</p>
</fieldset>
</div>
<hr />
<div id="CopiaUltimoConteudo"></div>
</body>
</html>
And here's the script:
document.getElementById("CopiaUltimoConteudo").innerHTML =
document.getElementById("BlocosDinamicos").querySelector("fieldset").innerHTML;