简体   繁体   中英

Bootstrap select not returning values in the 'changed' fired event

Using Bootstrap Select events

The 'newValue' and 'oldValue' in the callback function isn't returning any value, they are returning true and false respectively, but according to the documentation from the link above they should be returning values right?

 $('#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> 

Try using

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM