首页javascriptchildren_indexjQuery Selector - 如何选择一个元素如果它是子元素...

jQuery Selector - 如何选择一个元素如果它是子元素...

我们想知道如何选择一个元素如果它是子元素。...

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.9.1.js'></script>
<script type='text/javascript'>
$(window).load(function(){
    $('#wikiInfo').find("ol:lt(2)").css({"color":"red","border":"2px solid red"});
});
</script>
</head>
<body>
  <div id="wikiInfo">
    <ol>
      <li>1</li>
    </ol>
    <p></p>
    <ol>
      <li>2</li>
    </ol>
    <p></p>
    <ol>
      <li>3</li>
    </ol>
  </div>
</body>
</html>