How to Look Up Events in js

Asked 2 years ago, Updated 2 years ago, 19 views

I'm creating a page, typing text in a text box, and clicking anywhere in the page will erase the contents of the text box, so I'd like to find out what's going on when the cursor moves away from the text box. What should I do?

javascript

2022-09-29 22:14

2 Answers

Use the developer tool.

·When using Firefox
With Firefox, you can press F12 to get it out.Browse to the Inspector and press the button next to it to select an element of the screen (in this text box).The code for the selection appears below or to the right and turns blue.

If you have an event next to it, this is the event for that element.
If you have blur, that's the code.


2022-09-29 22:14

If it's Chrome, I think getEventListeners came out in the console.
window.getEventListeners( document.body.getElementById("text")


2022-09-29 22:14

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.