I have an HTML, where when doing the event mouseover
on a button, an input: text, and a p, these are hidden, and then when clicking on another p these are shown again, the problem is that the tag p I have it like this
<p id="show" onclick="show()">Pulsa aquí para que todo aparezca</p>
and I want it to be that way
<p id="show" onclick="show(button, input, p)">Pulsa aquí para que todo aparezca</p>
for later in JS do
function show(button, input, p) {
button.style.display = "initial"
input.style.display = "initial"
p.style.display = "initial"
}
the code is:
<center>
<div id="app">
<button id="boton" onmouseover="hide(this)">Botón que desaparece</button>
<br>
<br>
<input type="text" name="txt" id="txt" value="Caja que desaparece" onmouseover="hide(this)">
<br>
<p id="text" onmouseover="hide(this)">Texto que desaparece</p>
<p id="show" onclick="show()">Pulsa aquí para que todo aparezca</p>
<!-- en show(), quiero pasar por parametro el button, el input y el p -->
<!-- que quede show(button, input, text) -->
<!-- para poder ocultarlos al hacer click -->
</div>
</center>
<script>
let boton = document.getElementById("boton")
let txtBox = document.getElementById("txt")
let text = document.getElementById("text")
function hide(e) {
e.style.display = "none"
}
function show() {
boton.style.display = "initial"
txtBox.style.display = "initial"
text.style.display = "initial"
}
</script>