Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8712453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:06:45+00:00 2026-06-13T05:06:45+00:00

I am able to dynamically produce an Unicode character and insert it into a

  • 0

I am able to dynamically produce an Unicode character and insert it into a <div> by using sequences like &#x00f0;, but now I want to retrieve this input as an escape sequence, not the character itself.

Please see this JSFiddle example:

<button id="insertDh">insert funny d to mytext</button>
<div id="mytext"><i>mytext: please click button above</i></div>
<hr>
<textarea id="theSource"></textarea>
<button id="getSource">get mytext's source</button>

$("#insertDh").click(function() {
    $("#mytext").html("&#x00f0;");
});

$("#getSource").click(function() {
   $("#theSource").val($("#mytext").html()); 
});​

In other words, when I click “get mytext’s source”, I want to fill in the textarea with &#x00f0; and not ð. Is this possible? If so, how?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:06:46+00:00Added an answer on June 13, 2026 at 5:06 am
    $("#theSource").val(
        $("#mytext").html()
        // Replace non-ascii code-points with HTML entities.
        .replace(
          /[\ud800-\udbff][\udc00-\udfff]|[^\x00-\xff]/g,
          function (nonAscii) {
            var codepoint;
            if (nonAscii.length === 1) {  // A single basic-plane codepoint.
              codepoint = nonAscii.charCodeAt(0);
            } else {  // A surrogate pair representing a unicode scalar value.
              codepoint = 0x10000 + (
                ((nonAscii.charCodeAt(0) & 0x3ff) << 10)
                 | (nonAscii.charCodeAt(0) & 0x3ff));
            }
            return '&#x' + codepoint.toString(16) + ';';
          }));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to be able to dynamically insert a div at the end
I am able to create div tag dynamically but unable to create form tag
I would like to be able to dynamically read and write audio data in
I'd like to be able to change OnItemClickListener for a ListView dynamically. However, the
Not able to store all binary data values into sqlite3 table using QT. For
I want to be able to dynamically change what divs are show using radio
I want to be able to dynamically change width and height in a div
I want to be able to dynamically create ViewControllers based on a JSON file.
I need to be able to add rows to a table dynamically with jQuery
I have a dynamically created list. Items from the list should be able to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.