I need select element like this: $('[data-key=' + objectId + ']')
, but i need select this without jquery, using document.querySelector
or something else on pure JS.
You can do it with document.querySelectorAll('[data-key=' + objectId + ']')
and loop through all results
var allKeys = document.querySelectorAll('[data-key=' + objectId + ']');
[].forEach.call(allKeys, function(elem){
console.log(elem); //Do your stuff with each element
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With