- begins to think that
input
will bindblur
events, but the user"s click time control is also ablur
event that triggersinput
, which is not feasible .
- guess that it may be a
click
event bound todocument
. At this time, check whetherevent.target
containsclass
ofbootstrap
, but think that datepicker should not have a fixedclass
for every element.
The - guess will use the
containes
method, such as binding theclick
event ofdocument
to determine whether the currently clickedevent
is in the topclass
ofdatapicker
. - set up a
mask
layer on the page, the background is transparent, and thez-index
value is smaller thandatepicker
. When you click on other areas of the page, you click on themask
layer, and then the time control is hidden. But the user does not know that this is clicking on the transparent layer, and when clicking on other operable areas, the user will find that the click does not respond (because it is hiding the time control and hiding the transparent layer operation), and on the second click, the transparent layer has been removed before you can click on other actions. So this scheme will also have disadvantages
would you like to ask if there is any better way