label标签for属性修改样式

通过label标签for属性修改样式时,不会立即修改radio和checkbox的checked属性值,需要在radio和checkbox的表单元素上添加新的触发事件来修改checked属性值。变态的用法。。。
 

$(".requiredNotNull").click(function () {
    var type=$(this).attr("type");
    if(type == "radio"){
        if($(this).attr("checked")){
        }else{
            var name=$(this).attr("name");
            var inputList = document.getElementsByName(name);
            for(var i=0;i

 requiredNotNull可以不定义class



 

你可能感兴趣的:(js)