This is a handy way to target any element with a common string in the id. An element with id=”yourstring-whatever” would be targeted this way.
It does seem a little intensive on the DOM so maybe whittle down the elements to target it inside a container, thereby letting the browser know that it doesn’t have to go through the whole page, just to a container wherein it will find all the ids it might be looking for
Something like $(‘.yourcontainer [id^=”yourstring-“]’)
Anyway, enjoy!
$('[id^="yourstring-"]').on('touchstart click', function(e){ e.stopPropagation(); e.preventDefault(); console.log(this); }); };