O
O
OWIII2020-09-04 09:56:54
JavaScript
OWIII, 2020-09-04 09:56:54

Click not firing on inner element?

5f51e43f6e259178416231.jpeg
There is such a navigation. The click handler hangs on the square that I selected. Inside it there is also a div element that contains the text of the menu.
When the mouse lands on an inner element, the click does not work. Doesn't let you click.
How to make it so that you can click anywhere, including child elements?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hzzzzl, 2020-09-04
@OWIII

The click handler hangs on the square that I selected. Inside it there is also a div element that contains the text of the menu.

that is, a square separately, and a menu item separately?
if the inner div is just for this, then it would be more correct to increase the menu element through padding or line-height, and catch clicking on it, and not on another element

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question