セレクターその16(CSSの属性セレクター[attribute] [CSS3])

[attribute]で指定したattribute属性を持っている要素が抽出される感じ。

<html>
  <head>
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">google.load("jquery", "1.3.2");</script>
    <script type="text/javascript">
      $(function() {
        //id属性を持つタグだけ色が赤になる。
        $("[id]").css("color","red");
      })
    </script>
  </head>
  <body>
    <ul>
      <li id="first">テキストテキストテキストテキストテキスト</li>
      <li class="second">テキストテキストテキストテキストテキスト</li>
      <li id="third">テキストテキストテキストテキストテキスト</li>
      <li class="fourth">テキストテキストテキストテキストテキスト</li>
    </ul>
  </body>
</html>

で、1行目と3行目の文字色が赤になる感じ。