[英]How to select the attribute that inside an attribute using queryselector?
我想學習如何選擇包含“組”一詞的href
。 該href
位於role="present"
之下或之內。 請更正我的代碼
document.querySelectorAll("[role=article[href*="groups"]]")[1].innerHTML;
反引號 "`" 允許 ${} 訪問變量……另一種方法是將字符串連接在一起。
document.querySelectorAll(`[role=article[href*=${groups}]]`)[1].innerHTML;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.