Loop for deleting tags in a Tag-Input-Container under certain conditions

I was wondering if it is possible to create a loop that deletes tags in a tag-input-container (by clicking on the tags) until the char-info design-tags-left says: “24/25”. If the first number is below 24, no loop is required.

here’s a copy of the html element:
small data-v-7c26bd8e="" data-v-e0845560="" class=“char-info design-tags-left”>31 / 25</small

i actually have a workaround for this but i’m just curious to know how someone with more experience would approach this.


Which workaround? It’s always thinkable with Javascript (e.g. executeScript)