why if I write two window.onclick the first one will overwrite the second one, so only the first one would work, it is the onclick event doing this or window?
Can we see some code?
window.addEventListener("click",()=>{ console.log('wow')});
window.addEventListener("click",()=>{ console.log('wow 2')});
// On click
Output:
//VM257:1 wow
//VM270:1 wow 2
If you are doing something like this:
<button onclick="myFunction3()" onclick="myFunction()" >Click me</button>
<p id="demo"></p>
<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Hello World";
}
function myFunction3() {
document.getElementById("demo").innerHTML = "Hello World3";
}
</script>
Only the first onclick is used.
This is obviously a wild guess. Is this what you are trying to do?