[jQery]为文本框指定上拉弹出层

[jQery]为文本框指定下拉弹出层
$.fn.appendDropdown = function (dropdown$) {
    dropdown$
            .width(this.innerWidth())
            .mouseleave(function () {
                dropdown$.hide();
            }).css(
                {
                    position: "absolute",
                    top: this.position().top + parseFloat(this.outerHeight()),
                    left: this.position().left
                });

    dropdown$.parent().mouseleave(function () {
        dropdown$.hide();
    });

    this.click(function () {
        dropdown$.show();
    });
}

使用举例:

$('.reftree-ztree-container').each(function () {
        var container$ = $(this);  //下拉框所在的层
        var text$ = container$.prevAll(':text');  //文本框
        text$.appendDropdown(container$);
    })