gpt4 book ai didi

jQuery focusOut 除非

转载 作者:行者123 更新时间:2023-11-30 23:58:33 24 4
gpt4 key购买 nike

我只是想隐藏一个div,如果文本框失去焦点,除非用户单击另一个特定的div。如果用户单击该特定 div,则焦点不会触发 div.box 被隐藏。

下面是带有我的伪代码注释的代码。有什么想法吗?

textInput.focusout(function() {
// So long you didn't click div.stop, then
$('div.box').hide();
});

最佳答案

$(document).bind('click',function(e) {
if ($(e.target).closest('div.box').length) return;
$('div.box').hide();
});

试试这个!

关于jQuery focusOut 除非,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3766638/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com