I am trying to create an array with only the attribute data-id of each elements but getting an undefined array. What am I doing wrong ?
The declaration:
var list = [...document.querySelectorAll("#selection > tr")].map(el => el["data-id"]);
The elements:
<tbody id="selection">
{% for form in formset %}
<tr data-id={{form.instance.id}}>
</tr>
{% endfor%}
</tbody>
thank you
getAttribute("data-id")element.dataset[keyname](orel => el.dataset.idin your case)