3
I want an "if" that your condition is based on the location of the user’s click, but I have no idea how to refer to it. I believe on that basis you understand what I want to happen:
if (onclick == window) {executar bloco de código}
If you want to see my code:
HTML5:(only revealing code)
<li><img src="Backgrounds/Foto7.jpg" onclick="myFunction(this.src)"></li>...<div id="open">/*Imagem criada aqui*/</div></body>
Javascript
function myFunction(a) {
var NewImg = document.createElement('IMG');
document.getElementById('open').appendChild(NewImg);
NewImg.className = "open";
NewImg.setAttribute('src',a);
var DELIMG = document.getElementById('open');
if (onclick == NewImg){DELIMG.removeChild(NewImg)}
}
vc can refer to a div or an element, by Document.getElementById("suaDiv"), in case it is a div...
– MagicHat
So? if (onclick !== getElementById("myDiv")) {}
– user48589