4
For some reason that I do not know this time the browser does not want to render the code... basically I need to change the display: nome
of div
for display: block
through javascript.
botaoSticky = function(e) {
e.target.style.display = "none"
aparecerSticky()
}
const aparecerSticky = function(){
const mySticky = document.getElementsByClassName('sticky')
mySticky.style.display = "block";
}
.sticky{
display: none;
background: rgb(42, 197, 211);
height: 30vh;
width: 90%;
margin-top: 20px;
}
<aside>
<input type="button" value="botão sticky" class="botao" onclick=botaoSticky(event)>
<div class="sticky"><p>meu sticky</p></div>
</aside>
The element class index is missing. If it is the first, it would be:
document.getElementsByClassName('sticky')[0]
– Sam