[英]remove typeahead.js event from input box
I have a checkbox that triggers whether a typeahead feature is enabled on an input box or not. 我有一个复选框,可触发是否在输入框上启用了预输入功能。 This is what I have on the 'change' event: 这是我对“更改”事件的了解:
$("#checkbox").change(function() {
if ($("#checkbox").prop('checked')) {
$("#input").typeahead({
local: ['a', 'b']
});
} else {
//remove typeahead from the input box
}
});
How can I remove the typeahead feature in an else statement above? 如何在上面的else语句中删除预输入功能?
根据文档,您可以使用以下方法实现此目的:
$('#input').typeahead('destroy');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.