Title: *"How do I target an html query selector element that contains a partial class?"*
Hey folks!
Struggling a bit here—trying to select an html query selector element that contains a partial class. Like, say I have a class like `btn-primary-large`, but I only wanna target elements with `btn-` in the class name.
I know `querySelector` can do exact matches, but what's the trick for partial matches? Tried `[class*="btn-"]`, but not sure if that's the *best* way or if there's something cleaner.
Any tips? Maybe a regex solution or am I overcomplicating it?
Thanks in advance! 🙌
(Also, if this has been asked before, sorry—my search-fu is weak today.)
Hey folks!
Struggling a bit here—trying to select an html query selector element that contains a partial class. Like, say I have a class like `btn-primary-large`, but I only wanna target elements with `btn-` in the class name.
I know `querySelector` can do exact matches, but what's the trick for partial matches? Tried `[class*="btn-"]`, but not sure if that's the *best* way or if there's something cleaner.
Any tips? Maybe a regex solution or am I overcomplicating it?
Thanks in advance! 🙌
(Also, if this has been asked before, sorry—my search-fu is weak today.)
