zoukankan      html  css  js  c++  java
  • input 单选按钮radio 取消选中

    input单选按钮: 在radio按钮中添加属性tag  0代表未被选中

    <input name="rdo1" value="AA" type="radio" tag="0" />A
            <br />
            <input name="rdo2" value="BB" type="radio" tag="0" />B
            <br />
            <input name="rdo3" value="CC" type="radio" tag="0" />C

    jquery:

    $(":radio").click(function () {
                    var r = $(this).attr("name");
                    $(":radio[name=" + r + "]:not(:checked)").attr("tag", 0);
                    if ($(this).attr("tag") == 1) {
                        $(this).attr("checked", false);
                        $(this).attr("tag", 0);
                    }
                    else {
                        $(this).attr("tag",1);
                    }
                });

    Nobody gets to write your destiny but you.
  • 相关阅读:
    C# 基础笔记
    ASP.Net Jquery 随机验证码 文本框判断
    html 随机验证码
    冒泡排序
    工厂方法模式[Factory Mothod]
    单例设计模式[Singleton]
    设计模式之SOLID原则
    linux下配置zookeeper
    linux中安装nginx
    linux安装tomcat
  • 原文地址:https://www.cnblogs.com/loveAnimal/p/2615520.html
Copyright © 2011-2022 走看看