How to properly handle an onclick event in conjunction with an onblur

前端 未结 1 822
时光说笑
时光说笑 2021-01-14 22:13

The following post relates to a previous question I asked here.

Although the 2 problems are independent they do relate to the same feature that I implementing - predi

1条回答
  •  离开以前
    2021-01-14 22:45

    I tried a number of different things including wrapping both my text entry field and my autoFill div in a parent div and setting the onblur on the parent - but nothing worked. Apparently you cannot assign an onblur event on a div (since it cannot get focus to begin with).

    The answer was to set a Timeout on the onblur event as Seth has suggested.

    onblur="setTimeout(function() {closeSuggestionBox();}, 100);"
    

    I found a good explanation of this on a post here.

    0 讨论(0)
提交回复
热议问题