I want to open the suggestion menu of autocomplete
upon clicking some button. How to do that?
var dropDown = $("<a class='showAll' title='Show all'/>")
.insertAfter(this.element)
.button({
icons: {
primary: "ui-icon-triangle-1-s"
},
text: false
})
.removeClass("ui-corner-all")
.addClass("ui-corner-right ui-combobox-toggle")
.click(function () {
//What I have to write here?
});
suppose this button is inside autocomplete _create function. so i have autocomplete input element by this.element
Now, how should I proceed?
EDIT : I don't want to call search
event. I just want to open the suggestion menu simply.
Are you looking for this JQUERY DEMO . it also has the source code on how to code it.
As per comments i have tried some code sample at http://jsfiddle.net/UF8TV/
I was not able to get it working in your JSFiddle code (may be becuase there is no osurce and _renderItem ).
you want to check the line numbers 84 to 90.
if(input.val()=="Select"){
input.val("");
input.keydown();
}else{
input.autocomplete("widget").show();
}
I think in your code snippet below code should work .
if(jQuery(visibleElement).val()=="Select"){
jQuery(visibleElement).val("");
jQuery(visibleElement).keydown();
}else{
jQuery(visibleElement).autocomplete("widget").show();
}
You might even only need jQuery(visibleElement).autocomplete("widget").show();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.