zoukankan      html  css  js  c++  java
  • jquery 表单对象属性筛选选择器

    <!DOCTYPE html>
    <html>
    
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
        <title></title>
        <link rel="stylesheet" href="imooc.css" type="text/css">
        <style>
        input {
            display: block;
            margin: 10px;
            padding: 10px;
        }
        </style>
        <script src="https://www.imooc.com/static/lib/jquery/1.9.1/jquery.js"></script>
    </head>
    
    <body>
        <h2>子元素筛选选择器</h2>
        <h3>enabled、disabled</h3>
        <form>
            <input type="text" value="未设置disabled" />
            <input type="text" value="设置disabled" disabled="disabled" />
            <input type="text" value="未设置disabled" />
        </form>
    
        <script type="text/javascript">
            //查找所有input所有可用的(未被禁用的元素)input元素。
            $('input:enabled').css("border", "2px groove red");
        </script>
    
        <script type="text/javascript">
            //查找所有input所有不可用的(被禁用的元素)input元素。
            $('input:disabled').css("border", "2px groove blue");
        </script>
    
        <h3>checked、selected</h3>
        <form>
            <input type="checkbox" checked="checked">
            <input type="checkbox">
            <input type="radio" checked>       
            <input type="radio">
            
            <select name="garden" multiple="multiple">
                <option>imooc</option>
                <option selected="selected">慕课网</option>
                <option>aaron</option>
                <option selected="selected">博客园</option>
              </select>
    
        </form>
    
        <script type="text/javascript">
             //查找所有input所有勾选的元素(单选框,复选框)
             //移除input的checked属性
            $('input:checked').removeAttr('checked')
        </script>
    
        <script type="text/javascript">
             //查找所有option元素中,有selected属性被选中的选项
             //移除option的selected属性
            $('option:selected').removeAttr('selected')
        </script>
    
    </body>
    
    </html>
  • 相关阅读:
    示例页面
    HDU2149Public Sale(Bash 博弈)
    留言板
    HDU2188Bash博弈
    win7系统激活工具
    HDU1849Rabbit and Grass(Nimm博弈)
    HDU1846Brave Game(巴什博弈)
    drools原生drl规则文件的使用
    Vue element table动态生成列
    eltable动态生成列重点
  • 原文地址:https://www.cnblogs.com/wzndkj/p/11731815.html
Copyright © 2011-2022 走看看