JSFiddle - React, Tailwind, and code Playground

by Ben Philipp

HTML

<mycustom-thing-something>
  test true
</mycustom-thing-something>
<NOTmycustom-thing-something>
  test false
</NOTmycustom-thing-something>
<mycustom-thing-somethingelse>
  test true
</mycustom-thing-somethingelse>
<mycustom-thing-somethings>
  test true
</mycustom-thing-somethings>

JavaScript

var myPrefix = "mycustom-thing-";

$("body").children().each(function() {
  console.log("checking " + this.tagName);
  if (this.tagName.substr(0, myPrefix.length).toLowerCase() == myPrefix) {
    console.log(this.innerHTML); // or do whatever
  }
})