Jquery 无法获取当前聚焦的元素

Jquery 无法获取当前聚焦的元素,jquery,Jquery,我正在使用jquery自动调整大小插件来调整文本区域的大小 在插件中,我有这样的东西 (function($){ $.fn.autoResize = function(options, idToBeShown) { updateSize = function() { //shows the content underneath the textbox with a slidedown effect }, resetSize = fun

我正在使用jquery自动调整大小插件来调整文本区域的大小

在插件中,我有这样的东西

(function($){   
    $.fn.autoResize = function(options, idToBeShown) {

    updateSize = function() {
      //shows the content underneath the textbox with a slidedown effect    
    },

    resetSize = function(event) {
      //Slide up and hide the contents underneath the textarea  
    },


  textarea
    .unbind('.dynSiz')
    .bind('keyup.dynSiz', updateSize)
    .bind('keydown.dynSiz', updateSize)
    .bind('focus',updateSize)   //slide's down when focused
    .bind('focusout',changeSize)    //Slide up and hide the contents underneath the textarea
    .bind('change.dynSiz', updateSize);



  });
我的问题是,当我单击textarea下面的区域时,textarea不应该滑动,而是应该滑动 当我点击身体的任何地方时,它应该向上滑动

所以我做了这个

resetSize = function(event) {
//check the current focused element if it is the div area under text do do anything else slideup    
},
我无法获取当前关注的元素

1) document.activeElement返回正文

2) 试过的是(“焦点”)

3) 是(“:活动”)

什么都不管用。。。注意:我还将“id”添加到div元素。

尝试以下操作:

updateSize()

重置大小()


这不会在每次集中输入时将一个新的点击处理程序绑定到文档吗?对不起,我习惯于使用普通javascript,我更新了点击处理程序,这样它就添加了一个点击方法,而不是替换。
//process
$('#divId').addClass('active');
if($('#divId').hasClass('active')){
    //process
    $('#divId').removeClass('active');
}
$(":input").focus(function () {

    $(document).click(function(e) {
         //resetSize;
    });

});