I have the following question, I want to manipulate a specific value in my function, where the assigned value is not fixed but dynamic (where I can change it as needed).
function mostrardiv()
{
document.getElementById("teste").style.display = "block";
}
In document.getElementById the id it receives is test but I wanted to have the freedom that when calling the function in code I could change the value that is assigned to document.getElementById.
I've looked into the subject, just found how to use the prototype in javascript, but I still do not understand how I can change the value assigned in document.getElementByI.
The way I thought it looked more like this:
function mostrardiv(val)
{
document.getElementById(this.val).style.display = "block";
}
But it did not work in html I used the function like this:
<div class="row" >
<div class="col-md-2" onmouseover="mostrardiv('teste')" > <img class="img-responsive" src="_imagens/1.png" >
</div>