I am looking to add a button on my website landing page that can hide the weather section, but I am unsure how to go about it! https://i.sstatic.net/COA82.jpg
Currently, I am using a "selector" where I can choose either 0 or 1 from the bottom right corner, and it is functioning well. However, I would prefer to have a button instead. Below is the code snippet I am currently using:
</div>
<div class="wopacity">
<select onchange="myFunction(this);" size="2">
<option>0
<option selected="selected">1
</select>
<script>
function myFunction(x) {
// Get the text of the selected option
var opacity = x.options[x.selectedIndex].text;
var el = document.getElementById("p1");
if (el.style.opacity !== undefined) {
el.style.opacity = opacity;
} else {
alert("Your browser does not support this feature!");
}
}
</script>
</div>