[英]Take an element from DOM with not a common attribute
如果我們有這個:
<div class="test">
我們使用此DOM來調用它。
div.test
但是如果我們有這樣的自定義屬性
<div xpl-highlight="">
我們如何從DOM調用它
與使用CSS選擇器的操作相同
document.querySelector('[xpl-highlight]')
您可以像這樣選擇它: div[xpl-highlight]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.