Função ao clicar no botão
Bom Dia
Consegui da seguinte forma, mas com faço para que o código selecionado substitua o antigo?
<!DOCTYPE html>
<html>
<body>
<style>
#filtrotopo {
background: #484949;
}
}
#h4topo {
text-align: center;
color: white;
font-size: 18px;
}
#form1 section {
display: flex;
flex-wrap: wrap;
justify-content: center;
}h4 {
}
#form1 section label {
display: flex;
justify-content: center;
align-items: center;
margin: 0 10px;
/* width: calc(100% / 5); */
color: red;
text-align: center;
}
@media screen and (max-width:768px) {
#form1 section label {
margin-bottom: 20px;
width: 100%;
}
}
</style>
<div id="minhaEscolha"></div>
<div id = "filtrotopo">
<h4 style="text-align: center;" id="h4topo">Personalize</h4>
<form action="#" id="form1">
<section>
<label>
<button onclick="exemplo1()">
exemplo1</button>
</label>
<label>
<button onclick="exemplo2()">
exemplo2
</button>
</label>
</section>
</form>
<br>
</div>
<div id="teste1" style="display: none;">
<h3>Texto 1</h3>
<p>Sou o Texto 1</p>
<p>Tenho o nome de Texto 1</p>
</div>
<script>
function exemplo1() {
var x = document.getElementById("url");
var y = document.getElementById("minhaEscolha");
y.innerHTML = x.innerHTML;
}
</script>
<script>
function exemplo2() {
var x = document.getElementById("teste1");
var y = document.getElementById("minhaEscolha");
y.innerHTML = x.innerHTML;
}
</script>
<body>
</html>Discussão (0)
Carregando comentários...