I have a selector that gets all elements by certain condition:
let elements = $("...");
This results in a list of elements whose one of their classes has the same prefix:
some_class_1, some_class_2 and so on.
I then want to hide all elements that have the same class with addition:
some_class_1extra, some_class_2extra
For that I want to extract all the classes with this specific prefix, then iterate them and add the extra text and select the elements I want to hide for each.
How can I do it?
The following did not work:
let classes = elements.map(function() {
return (this.className.match(/some_class\d+/) || []).pop();
}).get();