How can I change the content of a clicked DOM ELement via JS condition?

I use a filter in a WordPress installation, I copy the name of the filter point (the respective category) over the result list in the DOM.

My question is, how can I catch the first filter point (All) via JavaScript and paste another name (All Facilities) to the place in the DOM?

My current JS code unfortunately only transfers the existing categories.

$(document).ready(function() {
// setze erst einmal den Titel für alle
$(“.einrichtungen”).append(‘Alle Einrichtungen’);

// reagiere auf die Klicks des Filters
$(".post-filter [href]").click(function() {
    $(".einrichtungen a.categorie-title").remove();
    $(this).clone().after().appendTo(".module-post").addClass('categorie-title text-center');
});

});

Can anyone give me a tip on how to implement this via JS?

Many thanks to all of you
m.orange