认识JS、javascript基础_checkbox_radio_select

引用参考:
推荐学习和使用JS的ES6版本
--JavaScript、ES5和ES6的介绍和区别
https://www.cnblogs.com/fuheng01/articles/JS.html
--ES5与ES6的对比
https://www.jianshu.com/p/1aad53b349e0
--JavaScript,ES5和ES6的区别
https://www.cnblogs.com/asand/p/7122143.html
--ES5与ES6的对比不同点
http://blog.csdn.net/changsimeng/article/details/62883952
https://www.cnblogs.com/tugenhua0707/p/6750498.html

1、js array 清空数组的3种方式
引用
http://www.cnblogs.com/snandy/archive/2011/04/04/2005156.html


2、checkbox

//校验账单选择
var isBillChoose=false;
$("input[name='billName']:checked").each(function(){
	if (true == $(this).attr("checked")) {
		isBillChoose=true;
		return false;//跳出整个循环
		//return true;//跳出当前循环
	}
});

function getPayRadioChecked(){
	var platForm=$("input[name='pay']:checked").val();
	return platForm;
}


//还款方式区域点击事件响应
		/* $("input[name='pay']").on('click',function(){
			alert('radio='+$(this).val());
			if ($(this).val()==3){
				$('.checkList').addClass('checkedit').find('input').prop('readonly',false).css('opacity',0.5);
			}else{
				$('.checkList').removeClass('checkedit').find('input').prop('readonly',true).css('opacity',1);
			}
		}); 
		
		//总金额点击事件响应
		$(document).on("click",".checkedit input",function(){
			alert("ok");
			$(this).val('').css('opacity',1);
		});*/


/**
 * 默认选中“微信支付”radio--2笔已出3种还款方式都支持
 * radio:'1'--银联在线支付; '2'--银行代扣; '3'--微信支付;
 */
function setRepaymentTypeChoose(typeValue){
    if ('1'==typeValue) {
    	$("input[type='radio'][name='pay'][value='1']").attr("checked",true);
		showUnionPayEffect();
    }else if ('2'==typeValue) {
    	$("input[type='radio'][name='pay'][value='2']").attr("checked",true);
    	showBankPayEffect();
    }else if ('3'==typeValue) {
    	$("input[type='radio'][name='pay'][value='3']").attr("checked",true);
    	showWXPayEffect();
    }
}

猜你喜欢

转载自franciswmf.iteye.com/blog/2300568