📌  相关文章
📜  jquery 获取当前焦点元素 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:22.801000             🧑  作者: Mango

代码示例1
// Get the focused element:
var $focused = $(':focus');

// No jQuery:
var focused = document.activeElement;

// Does the element have focus:
var hasFocus = $('foo').is(':focus');

// No jQuery:
elem === elem.ownerDocument.activeElement;