看板 Ajax 關於我們 聯絡資訊
想請問一下 我用cheerio爬一段網頁的HTML長這樣 <div class="compTitle mb-10"> <h3 class="title"> <span class="fc-6th fz-15px">n.名詞</span> </h3> </div> 我用過$(h3[class=title])但是因為有其他h3的class也叫title所以會出現其他東西 可是如果改成 $("h3[class=title]","div[class=comTtile mb-10]").html()卻會顯示null $("div.comTtile mb-10 h3.title".html()也是一樣, 而且不知道div的class中間空一格會不會讓選擇器搞錯class? 請問有什麼方法可以只抓這個裡面的text呢? 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.248.44.14 ※ 文章網址: https://www.ptt.cc/bbs/Ajax/M.1487606832.A.470.html
dannypsnl: 就跟JQuery一樣的用法啊 02/21 00:10
dynastat: 我懂了,謝謝回答 02/21 00:38