<div id="check">
<input name="" type="text" />
<input name="" type="text" />
<input name="" type="text" />
<input name="" type="text" />
<input name="" type="text" />
<a id="btn">获取</a>
</div>
function chk(){
$("#btn").click(function(){ var Num = $("#check input").length })
}
突然间脑子好像短路,竟然不知道怎么写 哪位帮帮忙吧
$(document).ready(function () {
$("#btn").click(function () {
alert('a');
var Num = $("#check input").length;
alert(Num);
})
})
</script>
$("#check input").each(function() {
if (!$(this).val()) {
num++;
}
});
或
var num = $("#check input").filter(function() {
return !$(this).val();
});