zoukankan      html  css  js  c++  java
  • checkbox限制选中个数

    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>无标题文档</title>
    <link href="sysStyle.css" type="text/css" rel="stylesheet"/>
    <link href="../crm-css/search.css" type="text/css" rel="stylesheet"/>
    <script src="jquery-1.7.2.js" type="text/javascript"></script>
    <script type="text/javascript">

    $(document).ready(function() {

      var isChk=$('#'+idd).is(':checked');//判断是否被选中

    $('input[type=checkbox]').click(function() {

    $("input[name='apk[]']").attr('disabled', true);

    if ($("input[name='apk[]']:checked").length >= 3) {

    $("input[name='apk[]']:checked").attr('disabled', false);
    alert("选中超过三个");

    } else {

    $("input[name='apk[]']").attr('disabled', false);

    }

    });

    })

    </script>

    <ul>

    <li>

    <input type="checkbox" name="apk[]" value=1 />

    APK1

    </li>

    <li>

    <input type="checkbox" name="apk[]" value=2 />

    APK2

    </li>

    <li>

    <input type="checkbox" name="apk[]" value=1 />

    APK3

    </li>

    <li>

    <input type="checkbox" name="apk[]" value=4 />

    APK4

    </li>

    <li>

    <input type="checkbox" name="apk[]" value=6 />

    APK5

    </li>

    <li>

    <input type="checkbox" name="apk[]" value=7 />

    APK6

    </li>

    <li>

    <input type="checkbox" name="apk[]" value=8 />

    APK7

    </li>

    </ul>

  • 相关阅读:
    python不同包之间调用时提示文件模块不存在的问题
    adb shell 查看内存信息
    adb shell top 使用
    Android读取logcat信息
    父类的引用对象指向子类的对象
    我的阿里梦——淘宝前端必备技能
    我也做了一个1/4圆形菜单
    可编辑tab选项卡
    canvas 之
    canvas之----浮动小球
  • 原文地址:https://www.cnblogs.com/yy123/p/4011685.html
Copyright © 2011-2022 走看看