Change text of a div after clicking the button

Asked

Viewed 10,990 times

0

  • Put your JS code and your HTML... otherwise it gets complicated

  • @Marllonnasser Follow css, html and javascript in the codepen: http://codepen.io/flashpremium/pen/080ab885152ec081e10b5449eb2b26c4

  • Hello @theflash ! Could you add your code here at Sopt? This makes it easy to search, and who will answer your question! If there are any questions, please, see this link!. From now on we hit!

1 answer

4

<html>
<body>

<p id="paragrafo">Clique no botão para mudar o texto</p>

<button onclick="funcao()">Clique aqui</button>

<script>
function funcao() {
    document.getElementById("paragrafo").innerHTML = "Pronto você mudou o texto (y)";
}
</script>

</body>
</html>

I hope that’s it (Y).

  • That’s right man! Thanks! But one thing, and how would you change the shopping cart button according to the click on certain button?

  • I didn’t understand the question ... it was bad ... you can ask ... and also wanted to know if I can use the code you have there, I can?

  • I’ve already solved it here. Which code would be?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.