How to change the function call?

How to run this function on click, but for example just at boot ?
document.getElementById("id").onclick = function() {
 namefunction({}, this);
}
June 14th 19 at 18:30
2 answers
June 14th 19 at 18:32
Solution
htmlbook.ru/html/attr/onload
or just namefunction({}, document.getElementById("id"));
June 14th 19 at 18:34


document.getElementById("id").onclick = fn;
function fn() {
 namefunction({}, this);
}
and that will be in this? - Violet_Wiso commented on June 14th 19 at 18:37
yeah... you need to turn in a variable will be. - rhianna_Fee commented on June 14th 19 at 18:40

Find more questions by tags JavaScript