zoukankan      html  css  js  c++  java
  • radio和label关联问题,点击label改变颜色

    $(function () {
        $("#fangan :radio[name='price']").bind('click', function (event) {
            //$(this).next().attr("class", "on");
            $("input[name='price']").each(function () {
                //这里是查找name=checkday的选框并遍历  当然你也可以直接用 $("input:radio")
    
                if ($(this).attr("checked") == "checked") {
                    //这里是判断是否被选中  
                    $(this).next().attr("class", "on")
                }
                else {
                    $(this).next().attr("class", "hide")
                }
            })
        })
        $("#fangan :radio[name='num']").bind('click', function (event) {
            //$(this).next().attr("class", "on");
            $("input[name='num']").each(function () {
                //这里是查找name=checkday的选框并遍历  当然你也可以直接用 $("input:radio")
    
                if ($(this).attr("checked") == "checked") {
                    //这里是判断是否被选中  
                    $(this).next().attr("class", "on")
                }
                else {
                    $(this).next().attr("class", "hide")
                }
            })
        })
        $("#fangan :checkbox[name='model[]']").bind('click', function (event) {
            //$(this).next().attr("class", "on");
            $("input[name='model[]']").each(function () {
                //这里是查找name=checkday的选框并遍历  当然你也可以直接用 $("input:radio")
    
                if ($(this).attr("checked") == "checked") {
                    //这里是判断是否被选中  
                    $(this).next().attr("class", "on")
                }
                else {
                    $(this).next().attr("class", "hide")
                }
            })
        })
        $("#fangan :checkbox[name='color[]']").bind('click', function (event) {
            //$(this).next().attr("class", "on");
            $("input[name='color[]']").each(function () {
                //这里是查找name=checkday的选框并遍历  当然你也可以直接用 $("input:radio")
    
                if ($(this).attr("checked") == "checked") {
                    //这里是判断是否被选中  
                    $(this).next().attr("class", "on")
                }
                else {
                    $(this).next().attr("class", "hide")
                }
            })
        })
    })
    

      

  • 相关阅读:
    谈敏捷的好文章
    梁信军说的话
    如何做需求管理
    支持向量机通俗解释
    如何写数据报告
    数据分析注意点
    傅盛谈管理的本质
    I Hate It HDU
    敌兵布阵 HDU
    P3372 【模板】线段树 1 (区间查询)
  • 原文地址:https://www.cnblogs.com/qinge/p/4877790.html
Copyright © 2011-2022 走看看