Jquery 移动设备选择选项的事件
我正在尝试从mobile上的select标记绑定选项上的事件,但是click事件处理程序中的代码不起作用,我不知道为什么 我认为点击不是这个特定标签的正确事件Jquery 移动设备选择选项的事件,jquery,html,mobile,Jquery,Html,Mobile,我正在尝试从mobile上的select标记绑定选项上的事件,但是click事件处理程序中的代码不起作用,我不知道为什么 我认为点击不是这个特定标签的正确事件 $('.show-select option').on('click',function() { console.log('pressed radio select') $(this).siblings().find('option').attr('selected',false) showNumber = par
$('.show-select option').on('click',function() {
console.log('pressed radio select')
$(this).siblings().find('option').attr('selected',false)
showNumber = parseInt($('.show-select option').filter(':selected').val().substr(5));
if($('.show-select option#all').text() === "All") {
showNumber = Infinity;
}
filterByBreed();
breederAnimate();
$('.breeder').not('.active').find('.breeder_breed_desc').each( animateBreeds )
})
那个控制台日志永远不会运行。我做错了什么
我认为点击不是这个特定标签的正确事件
$('.show-select option').on('click',function() {
console.log('pressed radio select')
$(this).siblings().find('option').attr('selected',false)
showNumber = parseInt($('.show-select option').filter(':selected').val().substr(5));
if($('.show-select option#all').text() === "All") {
showNumber = Infinity;
}
filterByBreed();
breederAnimate();
$('.breeder').not('.active').find('.breeder_breed_desc').each( animateBreeds )
})
当然是单击不是正确的下拉事件
您需要使用change
事件进行下拉,而不是单击:
$('.show-select').on('change',function() {
...............
...............