Assuming I have the following markup
<div data-common-notcommon="anyValue">
<!-- Whatever.. -->
</div>
<div data-common-not-commonerthing="anyValue">
<!-- Whatever.. -->
</div>
I'm trying to write a JS selector (or a CSS selector, don't care for the difference..) to find attributes based on a common, partial attribute name.
I.E I want to find all the elements that start with data-common
.
I can't find anything on Google for attribute name selectors but rather attribute value selectors which I don't really want to do.
<script>
document.querySelectorAll('[data-common]'); // []
document.querySelectorAll('[data-common*]'); // []
// etc..
</script>