Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

JavaScript how to find a class that is constantly changing

Example: the class was Paragraph__P2Short--18r8zx8 styles__DateUpdated--7vi2vd kYkeUS after an hour it changed to Paragraph__P2Short--vgyzhi styles__DateUpdated--6ztczv fQPIAt. How do I find such classes?

I tried document.getElementsByClassName("") but the class is constantly changing, but the styles__DateUpdated does not change in the class

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You might try a CSS selector with .querySelectorAll, like:

const elements = document.querySelectorAll('[class*="styles__DateUpdated--"]');

It will givve you all elements containing the string "styles__DateUpdated–" inside the class attribute. For sure you might have to go deeper to filter down to what you need…

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading