Bootstrap Select在'changed'触发事件中不返回值

时间:2018-08-15 04:22:24

标签: javascript jquery html bootstrap-select

使用Bootstrap Select 个事件

回调函数中的'newValue'和'oldValue'没有返回任何值,它们分别返回true和false,但是根据上面链接的文档,它们应该返回值吗?

$('#instructorLocationRadius').off('changed.bs.select').on('changed.bs.select', function(event, clickedIndex, newValue, oldValue) {
  scope.locationDistanceSearched = newValue; // newValue is returning true
});
<select id="instructorLocationRadius" class="selectpicker btn-group-lg" style="border-radius: 0px; color: #777;">
  <option class="distance" value="2">2 miles</option>
  <option class="distance" value="5">5 miles</option>
  <option class="distance" value="8">8 miles</option>
  <option class="distance" value="15">15 miles</option>
  <option class="distance" value="25">25 miles</option>
</select>

1 个答案:

答案 0 :(得分:-1)

尝试使用

$('#instructorLocationRadius').on('changed.bs.select', function(event, clickedIndex, newValue, oldValue) {
  scope.locationDistanceSearched = newValue; // newValue is returning true
});