首页javascriptchildren_indexjQuery Selector - 如何选择属性,并以特定值结束...

jQuery Selector - 如何选择属性,并以特定值结束...

我们想知道如何选择属性,并以特定值结束。...

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script type='text/javascript'>
$(window).load(function(){
    console.log($('ul:eq(1) > li').text())
});
</script>
</head>
<body>
  <ul>
    <li>Sample</li>
    <li>Sample</li>
    <li>Sample</li>
    <li>
      <ul>
        <li>Need to Get access to this li</li>
      </ul>
    </li>
    <li>Sample</li>
  </ul>
</body>
</html>