使用jquery方法的时候,要注意对象是哪个,否则很容易出错

 

 

 

 

 

 

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>W3Cschool教程(w3cschool.cn)</title>
<script src="js/jquery.js"></script>
<br>
<script type="text/javascript">
function open_win()
{
window.open("弹框1.html","_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400")
}
</script>
</head>

<body>
<div>
  <table>
    <tr>
      <td><input type="checkbox" value="111" /></td>
      <td><input type="checkbox" value="22" /></td>
      <td>1133</td>
      <td>1144</td>
    </tr>
    <tr>
      <td><input type="checkbox" value="333" /></td>
      <td><input type="checkbox" value="444" /></td>
      <td><input type="checkbox" value="22" /></td>
      <td>2233</td>
    </tr>
    <tr>
      <td><input type="checkbox" value="555" />
        <input type="checkbox" value="666" />
        <input type="checkbox" value="666" /></td>
      <td>3322</td>
      <td>3333</td>
    </tr>
    <tr>
      <td><input type="checkbox" value="777" /></td>
      <td><input type="checkbox" value="888" /></td>
      <td>4422</td>
      <td>4433</td>
    </tr>
  </table>
  <button type="button" value="打开窗口" >dddddd</button>
</div>
</body>
<script type="text/javascript">
    $(function(){    
        $("button").click(function(){
            $("table tr").each(function(){
                console.log($(this).find("td").find(":checkbox").last());

        console.log($(this).find("td").find(":checkbox:eq(1)"));
            })        
        })
    })

</script>
</html>

posted on 2017-09-22 16:56  2015熊出没  阅读(119)  评论(0编辑  收藏  举报