I’d like to display the “Open Lock” character in my HTML link text.
If I do it directly it shows up correctly with <a id="myId">🔒</a>, but I found no way to change it dinamically with the jQuery .text() function, like in:
$("#myID").text(openLockText);
What should I put in openLockText?
Javascript internally only supports UTF-16.
Because this is an extended 32-bit UTF character (not in the “Basic Multilingual Plane”) you need to insert the “UTF-16 surrogate pair”, which is helpfully provided on the same page that you linked to:
i.e.
More details can be found in RFC 4627, which is strictly speaking the format for JSON.