javascrip下拉框、复选框的一些操作

下拉框的一些基本操作

//1.获取下拉框的值
var radioValue = $("#radio option:selected").val();
//2.将下拉框中的某个值设置为选中状态
$("#opt option").each(function(){
	if($(this).val() == nowOpt){
		this.selected = true;
	}
});

复选框的一些操作

if($(obj).prop("checked")){
	$(".styled").prop("checked",true);
}else{
	$(".styled").prop("checked",false);
}

猜你喜欢

转载自blog.csdn.net/qq_40247975/article/details/83061828