我有这个代码,它会选择等于5的选择框。我如何只计算选择
<div id="groupa">
这是我的代码
function getSelectedValues(){
var matches = $('select').filter(function(){
return $(this).val() == '5';
}).length;
// here's where we just update that new <span>
$('span#result5').text(matches);
}
答案 0 :(得分:0)
更改选择器
function getSelectedValues(){
var matches = $('#groupa select').filter(function(){
return $(this).val() == '5';
}).length;
// here's where we just update that new <span>
$('span#result5').text(matches);
}