<!--
// One of those very useful snipts.  jQuery has the partial match selectors, however I didn't
// realise native JS used them too.
//
// So given a concept of the following basic HTML:
-->

<div id="my-widget-1" class="my-widget-1"></div>
<div id="my-widget-2" class="my-widget-2"></div>


<!--
// You may want to get all elements where the class (or id) starts with
// my-widget-
-->

<script>
    
    var myElements = document.querySelectorAll('[class^=my-widget-]');
    
</script>

<!--
// Which basically means you can use the other partial match structures like in jQuery to
// get the desired elements
-->