I am trying to compare a custom attribute of a given element to that custom attribute of all other elements with a specific class... here is what I have
function choose(el){
var text = $(el).getAttribute("data-custom");
var list = document.getElementsByClassName("class");
for (var i = 0; i < list.length ; i++) {
if (list[i].getAttribute("data-custom") == text) {
/*DO STUFF*/
}
}
}
html
<div onclick="choose(this)">STUFF</div>
Currently I get a "$(...).getAttribute is not a function" error.
attr()