Skip to content

How to use localize-content with JS? #31

Answered by LazZiya
Sayed-Mahmoud asked this question in Q&A
Discussion options

You must be logged in to vote

Create a hidden HTML item with the localized text, then grab its value with js.

<i style="display:none;" id="txt" localize-content>Delete</i>

<script>
    var delText = document.getElementById("txt").innerText;
    var button = document.createElement('a'); 
    button.appendChild(document.createTextNode(delText));
    ...
</script>

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Sayed-Mahmoud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants