我似乎无法在 jQuery 1.6 中获得 type 属性
<div id="div_id">
<input type="text" value="foo" />
<input type="text" value="foo" />
<input type="text" value="foo" />
<input type="text" value="foo" />
<input type="checkbox" checked="checked" />
</div>
和jQuery
$.each('#div_id input',function(index,value){
var input_type = $(this).prop('type')
alert(input_type);
/*
switch(input_type) {
case 'checkbox':
$(this).prop('checked',false);
break;
//more cases here
default:
this.value = '';
}*/
});
看我的小提琴