jorgehvieriasilva Posted May 17, 2018 at 04:40 PM Report #610588 Posted May 17, 2018 at 04:40 PM Boa tarde a todos, estou com um pequeno erro num certo código javascript. Eu tenho uma div, que quando a página carrega deve estar invisível, e quando carrego num botão ele fica visível. A página carrega, a div não aparece, só que quando carrego no botão ela aparece e volta a desaparecer. Os meus códigos são os seguintes: JS <script> function togglediv(id) { var div = document.getElementById(id); div.style.display = div.style.display == "block" ? "none" : "block"; } </script> HTML <button onclick="togglediv('painel_secundario1')">Ver</button> <div id="painel_secundario1" style="display: none;"> Obrigado a todos que ajudarem.
JakeBass Posted June 27, 2018 at 08:55 PM Report #611153 Posted June 27, 2018 at 08:55 PM Estive a testar e funciona, qual é o browser?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now