Javascript 获取引导类型先行参数

Javascript 获取引导类型先行参数,javascript,twitter-bootstrap,typeahead.js,Javascript,Twitter Bootstrap,Typeahead.js,我只想在代码中的任何地方获取typeahead控件的“minLength”参数 我该怎么做 控件的定义如下: $('#typeahead').typeahead({ hint: true, highlight: true, minLength: 3 }, .... 你可以试试这个 var options = { hint: true, highlight: true, minLength: 3 } $('#typeahead').typeahead(options)

我只想在代码中的任何地方获取typeahead控件的“minLength”参数

我该怎么做

控件的定义如下:

$('#typeahead').typeahead({
  hint: true,
  highlight: true,
  minLength: 3
},
....
你可以试试这个

var options = {
  hint: true,
  highlight: true,
  minLength: 3
}

$('#typeahead').typeahead(options)
// and to get the minLength just use options.minLength
console.log(options.minLength);

但是我需要在另一个地方得到minLength,在那里我没有这个“options”变量。