Suppose I have bunch of rows under foo bar row-id* class name pattern. How do I match all rows under that pattern using querySelectorAll?
document.querySelectorAll(".foo.bar.[=*row-id]")
This doesn't work as expected.
[class^="foo bar row-id"] will match what you're looking for. This searches for all class staring with .foo bar row-id. You can swap class for any other HTML attribute as well.
[class$="foo bar row-id"] will match class ending with your query.
[class*="foo bar row-id"] will match all class that contains your query.
Example:
var items = document.querySelectorAll('[class^="foo bar row-id"]');