나는 타입 업하기 위해 source
을 바꿀 방법을 찾고 있습니다.부트 스트랩 타입 어 헤드 - 변경 소스
예를 들어, 다음 2 개의 목록이 있다고 가정하고 사례에 따라 다른 소스로 작업하고 싶습니다.
var list1 = ["this", "is", "first", "list"],
list2 = ["second", "list", "comes", "here"];
$("selector").typeahead({source: list1})
그럼,
$("selector").typeahead({source: list2})
을하고 입력 상자에 입력을 시작하면, 첫 번째 목록은 새로운 아래에 나타납니다.
나는 아무 효과가 없습니다, 그러나$("selector")
.removeData()
.typeahead({source: list2})
을 수행했습니다.
$("selector").data('typeahead').source = list2;
가능한 중복 : // 유래 .com/questions/13516396/how-to-update-source-option-in-bootstrap-typeahead-js) –