I'm trying to replace text only, but without touching any other tags.
<p>
<a href="login.php">
<i class="fa fa-sign-in"></i>
Login
</a>
</p>
$('p').each(function() {
$(this).text($(this).text.replace('Login', 'Anmeldung'));
});
Bad result:
<p>
Anmeldung
</p>
Result as I would like it to be:
<p>
<a href="login.php">
<i class="fa fa-sign-in"></i>
Anmeldung
</a>
</p>
How can I do this? This is only a sample, deeper structure of p
tags can be completely different.