as shown in the figure below, on the mobile phone, there is an input box that has been bound to the data source of typeahead. It is applicable to the default input keyboard of the phone to achieve automatic completion after entering characters. However, in reality, you want to add a button to the interface as input without the default keyboard of the phone, but in this case, you can not use the automatic completion function of typeahead. You want to know how the typeahead can be triggered?
cannot match through custom buttons:
:
the implementation code is as follows:
// html
<div class="form-group" style="margin-left: -16px;">
<label for="englishTxt" class="col-sm-2 control-label">English:</label>
<div class="col-sm-6">
<input type="text" class="col-sm-12" id="englishTxt" data-provide="typeahead" style="width: 72%;" >
<div style="float: right;">
<input type="button" id="translate" class="btn btn-success col-sm-2" style="margin-top: -5px" value="">
</div>
</div>
</div>
// js
$("-sharpenglishTxt").typeahead({source: EngDatabase});
$("-sharpa").click(function() {
$("-sharpenglishTxt").val($("-sharpenglishTxt").val() + $("-sharpa").text());
});