What is the problem of jquery event listening and binding?

<html>
<head lang="zh-CN">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Hello</title>
    <script src="js/jquery-3.3.1.js"></script>
    <script>
        $(document).ready(function () {
            $("p").click(function () {
                $(this).hide();
            });
        });
    </script>
</head>
<body>

click

</body> </html>

bind events to elements like < p onclick="xx" > , and < script > p.click=xx or p.addEventListener < / script >
. After clicking, call the corresponding function to understand

.

but how does jquery listen to this event anytime and anywhere after clicking click with jquery,?

there is no explicit code, listening and binding events

after listening for an event, how do you bind the event to a specific function?

topic description

sources of topics and their own ideas

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Jun.07,2021

The underlying layer of

jquery also calls addEventListener and, of course, compatibility with ie.

he also tied the event to DOM


Thank you. Do you have any relevant reference documents or Baidu search keywords? I'd like to know something about it.


the bottom layer of jQuery is the native js, that is called, but the framework will make its own API and usage rules, as do other frameworks and libraries.

$("p").click(function () {
    $(this).hide();
});

like this code can be disassembled: selector, event, body
you can write it again with similar native js code, and you will know how jQuery implements

.
$('-sharpbtn').on('click', function() {
  console.log('test')
})

corresponding call stack

clipboard.png

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d178-2bbbb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d178-2bbbb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?