(010)jquery_同胞选择器

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    <title>f_html.html</title>
    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
    <style type="text/css">
        div, p, label
        {
            float: left;
            border: solid 1px #ccc;
            margin: 5px;
            padding: 5px;
        }
        p,label
        {
            width:230px;
            height:30px;
        }
        p
        {
            border: solid 1px red;
        }
    </style>
    <script type="text/javascript" src="../js/jquery/jquery190.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $("p~label").css("border","solid 5px green");
        });
    </script>
  </head>
  
  <body>
        <div>
            码农家族
            <label></label>
            <p></p>
            <label></label>
            <label></label>
        </div>
        <label></label>
  </body>
  
</html>

获取p元素后面,且与p元素同级的label元素

posted @ 2014-12-08 14:18  雪中飞雁  阅读(157)  评论(0)    收藏  举报