Jak wybrać atrybut danych w JavaScript
const link = document.querySelector('[data-link="1"]');
Anthony Smith
const link = document.querySelector('[data-link="1"]');
//javascript get html data attribute
<button data-id="1" >Click</button>
<button data-id="2" >Click</button>
<button data-id="3" >Click</button>
const btns=document.querySelectorAll('button[data-id]');
[...btns].forEach(btn => console.log(btn.getAttribute('data-id')))
$("[attribute=value]")
const article = document.querySelector('#electric-cars');
article.dataset.columns // "3"
article.dataset.indexNumber // "12314"
article.dataset.parent // "cars"