zoukankan      html  css  js  c++  java
  • Jquery中.attr与.prop的区别

    ☆    http://www.jb51.net/article/114876.htm     http://www.365mini.com/page/jquery-attr-vs-prop.htm    https://www.cnblogs.com/smartXiang/p/5686800.html  
    ☆    <!DOCTYPE html>                             https://www.cnblogs.com/ipetergo/p/6491321.html
        <html>
        <head>
        <meta charset="utf-8">
        <title>菜鸟教程(runoob.com)</title>
        <script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js">
        </script>
        <script>
        $(document).ready(function(){
            $("button").click(function(){
                $("#p1").html("attr('checked'): " + $("input").attr('checked')        //checked
                        + "<br>prop('checked'): " + $("input").prop('checked'));    //true
            });
        });
        </script>
        </head>
        <body>
    
        <p><b>注意:</b>确认或取消选中该复选框,然后单击按钮刷新内容。</p>
        <button>查看attr() 和 prop() 的值</button>
        <br><br>
        <input id="check1" type="checkbox" checked="checked">
        <label for="check1">Check me</label>
        <p id="p1"></p>
    
        </body>
        </html>   
    
    ☆     $('input[id = planStartTime_add]').attr("disabled", true);
    ☆     <div id="scan_div" class="editTraningClass content" >xxx</div>
        var $div_detail = $('div#scan_div');    
        $div_detail.find('input').attr('readOnly', true);
        $div_detail.find('textarea').attr('readOnly', true);
        $div_detail.find("input[id=planStartTime_scan]")attr('disabled', true);
         

      http://www.365mini.com/page/jquery-prop.htm 【 jQuery.prop() 函数详解】;

  • 相关阅读:
    C# 函数式编程
    【python】 入门 搭建环境
    luogu P3978 [TJOI2015]概率论
    luogu P4778 Counting swaps
    luogu P2480 [SDOI2010]古代猪文
    luogu P3243 [HNOI2015]菜肴制作
    luogu P4744 [Wind Festival]Iron Man
    luogu P4448 [AHOI2018初中组]球球的排列
    luogu P1593 因子和
    luogu P1943 LocalMaxima_NOI导刊2009提高(1)
  • 原文地址:https://www.cnblogs.com/hahajava/p/9044411.html
Copyright © 2011-2022 走看看