jQuery each()函数

    xiaoxiao2021-04-11  30

    <!DOCTYPE html> <html>     <head>         <meta charset="utf-8" />         <script type="text/javascript" src="js/jquery-3.1.1.min.js" ></script>         <link rel="stylesheet" href="css/style.css" />         <title></title>         <script>             $(function(){                 $(but).click(function(){                     $(cb).each(function(){                         $(this).attr("checked",true);                         alert($(this).val());                     }) ;                 }) ;                              }) ;           </script>     </head>     <body>         <input type="checkbox" id="cb" value="one"/>one          <input type="checkbox" id="cb" value="two"/>two          <input type="checkbox" id="cb" value="three"/>three <br/>         <input type="button" id="but" value="按钮" />     </body> </html>  

     

    转载请注明原文地址: https://ju.6miu.com/read-667030.html

    最新回复(0)