How do I target an HTML query selector element that contains a partial class? or What's the best way

22 Replies, 2110 Views

Thanks everyone! `[class*="btn-"]` worked like a charm—didn’t realize it was that straightforward.

I tried the regex approach too, but yeah, it felt clunky compared to CSS selectors.

One follow-up: What if I need to exclude elements with *both* `btn-` and `disabled`? Would `[class*="btn-"]:not([class*="disabled"])` work?

Y’all are lifesavers! 🙏

Messages In This Thread



Users browsing this thread: 1 Guest(s)