當前位置:編程學習大全網 - 網站源碼 - jq或者js通過div的id獲取裏面所有p標簽class為title的內容

jq或者js通過div的id獲取裏面所有p標簽class為title的內容

<!doctype?html>

<html>

<head>

<meta?charset="utf-8">

<title>獲取內容</title>

</head>

<body>

<div?id="test">

<p?class="title">1111</p>

<p?class="content">10101010</p>

<p?class="title">222</p>

<p?class="content">20202020</p>

<p?class="title">333</p>

<p?class="content">30303030</p>

</div>

<script?src="/jquery/1.12.4/jquery.min.js"></script>

<script>

var?array?=?$('#test').find('p.title').map(function?(index,?ele)?{

return?ele.innerHTML;

}).get();

console.log(array);

</script>

</body>

</html>

  • 上一篇:星球重啟第三章劇情完成後為什麽沒有刀配方
  • 下一篇:把這個公式改成通達信謝謝
  • copyright 2024編程學習大全網