You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I found a pretty simple solution. You may show predefined suggestions on focus when query is blank.
$('.typeahead').typeahead({source: function(query,process){if(query==""){//query is blank: show predefined suggestionsreturnthis.process([{"id":172,"name":"default item 01","url":"http://www.test.com"},{"id":73,"name":"default item 02","url":"http://www.test2.com"}]);}else{//query is not blank: make an ajax callreturn$.post("http://example.com/query",{query: query},function(data){data=$.parseJSON(data);returnprocess(data);});}},fitToElement : true,minLength : 2,theme : "bootstrap4",afterSelect: function(args){window.location.href=args.url;},}).on("focus",function(e){if($(this).val()==""){vartypeahead=$(this).data("typeahead");typeahead.query="";typeahead.source("");}});
Hi!
I have question - it is possible to show suggestions list after user click in input ?
I mean something like google, show list only click in input
thanks for answer!
The text was updated successfully, but these errors were encountered: