美文网首页
createAutoComplete

createAutoComplete

作者: 聚齐 | 来源:发表于2017-11-12 21:19 被阅读2次

functioncreateAutoComplete(element, url, init_search, table_id) {

$(element).autocomplete({

source: url,

position: {my:"right bottom",at:"right top"},

minLength: -1,

change:function( event, ui ) {

varrowid=$(element).attr('rowid');

console.log(rowid);

},

create:function( event, ui ) {

if(($(window).height() -$(element).offset().top) <107)

{

$( element ).autocomplete("option","position", {my:"right bottom",at:"right top"} );

}

else

{

$( element ).autocomplete("option","position", {my:"left top",at:"left bottom"} );

}

}

});

$(element).focus(function() {

if(($(window).height() -$(this).offset().top) <107)

{

$(this).autocomplete("option","position", {my:"right bottom",at:"right top"} );

}

else

{

$(this).autocomplete("option","position", {my:"left top",at:"left bottom"} );

}

if(init_search ==true)

{

$(this).autocomplete("search","");

}

});

}

相关文章

网友评论

      本文标题:createAutoComplete

      本文链接:https://www.haomeiwen.com/subject/fpiomxtx.html