-2
Hi, I need to change the content (code) of a javascript section with the function . click or onClick but the content can’t go on for the other Section! Thanks
-2
Hi, I need to change the content (code) of a javascript section with the function . click or onClick but the content can’t go on for the other Section! Thanks
1
If I understand what you want, I think this is it:
var btn = document.getElementById('btn-sect1');
var sect1 = document.getElementById('sect1');
btn = btn.addEventListener('click', function() {
sect1.innerHTML = '<h1>Agora já não é o original</h1><p>Está aqui outro codigo html</p>'
});
<section id="sect1">
<h1>Aqui está o codigo original da sect1</h1>
</section>
<section id="sect2">
<h1>Aqui está o codigo original da sect2</h1>
</section>
<button id="btn-sect1">Mudar HTML da sect1</button>
Browser other questions tagged javascript jquery html
You are not signed in. Login or sign up in order to post.
In case you could add more than one tag!
– user50404
@user50404 More than one tag? As well, more than one HTML tag inside the Section where we want to change the HTML?
– Miguel