Hi everyone! I'm the author of code.mu :)
I'd love to chat with my non-Russian audience. I'm looking for your feedback on the site and the translation quality. Let's chat:)
⊗jsPmDmDEH 347 of 504 menu
◀ ▶

Handlers for different events in JavaScript

In addition to clicking on an element, there are other events. For example, using the dblclick event, you can catch a double click on an element, using the mouseover event - hovering over the element, and using the mouseout event - leaving the cursor from the element.

At the same time, handlers of various types of events can be attached to one element. Let's, for example, bind a cursor hover response and a leave response to the same element:

button.addEventListener('mouseover', function() { console.log('1'); }); button.addEventListener('mouseout', function() { console.log('2'); });

Given a button. By double-clicking on it, display some message.

Given a button. Display a message by hovering over it.

Given a button. When the cursor leaves it, display some message.

Given a button. Display one message when you hover over it, and another message when you leave it.

← →
↑
English▼
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline