The bizarre problem of the JavaScript click event. Please give me some advice.

Code:

<button class="del-btn">
    <i class="layui-icon"></i>
</button>

$(".del-btn").on("click", function () {
    alert("");
});

question:

The style of

this button is shown above. Click on the area outside the text, and the click event will trigger normally, but clicking on the text will not work. At first, I thought it was the problem with the jQuery library, so the code was changed to this:

<button class="del-btn" onclick="alert("")">
    <i class="layui-icon"></i>
</button>

the result is still the same. Please answer the question from friends who have encountered similar questions. Except for the text area, there is no problem. The click icon will trigger click, normally. Why is the text invalid?

Mar.28,2021

is there such a problem?


event bubbling mechanism


button and input [type = "button"] Click event binding is different


 <i class="layui-icon"></i>

whether this tag uses absolute positioning, the high level leads to

.

put a testable connection out, there is no way to get people to help you.

or you can console.log (evt.target) to see what you click on

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