I'm using the Wordpress Avada Theme and I'm trying to translate the social media privacy labels/contents using jQuery. So far it works fine but one thing does not.
Here is the HTML:
function translate() {
jQuery(".fusion-privacy-label").text(function() {
return jQuery(this).html().replace("For privacy reasons Google Maps needs your permission to be loaded. For more details, please see our ", "Here is some example translation text. For more Details, please visit");
});
}
setTimeout(translate, 1000);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="fusion-privacy-label">
For privacy reasons Google Maps needs your permission to be loaded. For more details, please see our
<a class="privacy-policy-link" href="https://example.com/privacy/">Privacy</a>.
</div>
That works so far but it also deletes the <a class="privacy-policy-link" href="https://example.com/privacy/">Privacy</a>
HTML link. I don't want to translate this HTML link. If I try to add <a class="privacy-policy-link" href="https://example.com/privacy/">Privacy</a>
within my translation, it shows as text and not as a HTML Link element.
What I want is just the Translation of the first text part, not the a-tag element or the text within the a-tag.
What did I wrong?