Q:

How do i make a  section invisible when a button is clicked (JS)?

How can I hide a <div> section with JS and
<div class="alertB1">
<div class="sticky">
<h1> This site is still being built</h1>
<p> Please remember this site is still being built. Click <a href="form1.html">here to report a bug </a>
</div>
</div>
<style>
.sticky {
position: -webkit-sticky;
position: sticky;
}
.alertB1 {
width: 100%;
height: 125px;
background: lightgreen;
}

</style>

So I am looking to include a button with:
<span id="a33"><button>&times;</button></span>
</div>
</div>

How can I get the <span> to hide the <div> tag?
Thanks,
Ring Games

A:

Use onclick attribute;
More info: DOM onevent handlers

.sticky {
  position: -webkit-sticky;
  position: sticky;
}
.alertB1 {
  width: 100%;
  height: 125px;
  background: lightgreen;
}
<div class="alertB1">
  <div class="sticky">
    <h1> This site is still being built</h1>
    <p> Please remember this site is still being built. Click <a href="form1.html">here to report a bug </a></p>
    <span onclick="document.getElementsByClassName('alertB1')[0].style.display = 'none'" id="a33"><button>&times;</button></span>
  </div>
</div>

