Linked Questions

10 votes
3 answers
22k views

It seems to me that both events are fired when every resource and its dependent resources have finished loading. This rises some questions: Is there any difference between those events? Which event ...
Chilly Code's user avatar
10 votes
2 answers
22k views

I'm little confusing by using "onclick" "onmousedown" as a property of HTML elements. Such as: <button onclick="my_JS_function()"></button> or <div onmousedown="...
Paweł Brewczynski's user avatar
8 votes
2 answers
22k views

I already know the Jquery solution $('#myid').one('click', function(event) { ... }); But now I'm finding the Pure JavaScript way because I'm not using Jquery I have checked the once option but it ...
Patrissol Kenfack's user avatar
32 votes
0 answers
25k views

Can someone please explain what the difference is between the following two ways to specifying onload callback functions in javascript? element.onload = callback AND element.addEventListener("load",...
VinnyD's user avatar
  • 3,570
-1 votes
6 answers
305 views

Both codes below do the same thing, first using Vanilla JS and second using JQuery. JQuery code do not have to insert anything inside html tags, while JS have to insert the caller "onclick="myFunction(...
sergio trajano's user avatar
0 votes
1 answer
2k views

New to javascript and I find myself often trying one before realizing the other one is what I need, are they not doing the same thing?
DylanB's user avatar
  • 119
0 votes
1 answer
2k views

I was wondering what is the difference between those two ways of listening a message. Here is my assumptions: window.onmesage = onMessage This assign a function to the onmessage attribute of the ...
Ganbin's user avatar
  • 2,073
0 votes
3 answers
1k views

I apologize if this post has been made before but I wasn't able to find it. Imagine we have <button class="sample-class" role="button" tabindex="0" id="onEvent">play</button> and then a ...
Izy-'s user avatar
  • 1,173
0 votes
2 answers
2k views

Is it possible to have two listener listening to the same event? I have an event listener listening for the oncanplay video event, and in some other class, in this example the test class, I have to ...
yalpsideman's user avatar
2 votes
1 answer
2k views

Can someone explain what is the proper way to make certain actions call functions in javascript? Should I use event handlers like onclick="callFunction();"? Or should I use an event listener? If yes, ...
Aillyn's user avatar
  • 23.9k
2 votes
1 answer
991 views

I am developing an app and speed is a concern. When attaching events to elements there are two ways that I know how to do it: element.addEventListener('click', function() { // code to execute ...
Denis Priebe's user avatar
  • 2,895
1 vote
1 answer
907 views

What is the difference between using addEventListener() in your Javascript code like this example: Array.from(document.querySelectorAll('.element')).forEach(el => { el.addEventListener('ondrop',...
codedude's user avatar
  • 6,577
1 vote
2 answers
935 views

I'm curious here, I know that it's possible to attach multiple event handlers to same element if I use DOM Level 2 method called addEventListener(), so I'm wondering if we have this situation: ...
rokie12234's user avatar
0 votes
1 answer
995 views

Are any of these versions correct? I would like the icon to change after clicking the menu. in Javascript these are my beginnings and I don't know what is right const menu = document.querySelector('#...
Greemi's user avatar
  • 1
2 votes
3 answers
188 views

If I have below button : <button type="button" id="send_email" class="btn btn-primary" onclick="sendEmail();">Send</button> So, which is better calling JS function or using click event ...
Pravesh Mehta's user avatar

15 30 50 per page
1
2 3 4 5
19