Function execution problems in delegate events and normal binding events

The

clipboard.png
code is as follows:

    $(".password").on("keydown", function(e) {
        if (e.keyCode === 13 && !e.ctrlKey) {
            e.preventDefault();
            $(".loading-btn").click(denlu());
        }
    })
    $(".loading-btn").click(function(){denlu()});

if $(".loading-btn") .click (function () {denlu ()}); written as $(".loading-btn") .click (denlu ()); page refresh will be performed directly, but not in $(".password"). On ("keydown", function (e) {}). Why? Please advise Thanks ()


first understand the jQuery event method: the
event method triggers an event that matches an element, or binds a function to an event of all matching elements.

combine your code
trigger:

$('.loading-btn').click(denlu());

bind function:

$(".loading-btn").click(function(){denlu()});

if it is triggered and is not placed in the callback (function) of an operation, it will be triggered when the current line of code is read, so
$('.loading-btn') .click (denlu ()); will immediately trigger $('. Loading-btn'). Click,
so denlu () in click () will also be executed as a function expression statement.

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-1e3ac33-445d9.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-1e3ac33-445d9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?