'Append data-filter value to filtered elements urls in portfolio

i have a website built whit elementor and i would like to add the value contained in the data-filter as anchor to the url of the active results of a portfolio.

the filter code is:

<ul class="elementor-portfolio__filters">
<li class="elementor-portfolio__filter" data-filter="114">FILTER NAME</li>
...
</ul>

the active elements code is:

<article class="elementor-portfolio-item ... elementor-active">
<a class="elementor-post__thumbnail__link" href="URL">
content         
</a>
</article>

i would like to click an .elementor-portfolio__filter to add the data-filter value in every .elementor-portfolio-item.elementor-active url, such as https:// example.com/portfolio-url#DATA-FILTER-VALUE.

can someone recommend me some resources from which to be inspired in creating such a script?

thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source