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

  • SEARCH
  • Home
  • 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 8460865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:43:20+00:00 2026-06-10T13:43:20+00:00

I would like to have a contentEditable div that will contain user-inputted XML. How

  • 0

I would like to have a contentEditable div that will contain user-inputted XML. How would I go about storing a set of hidden data on each node, that will persist even after a cut/paste (i.e. move) ?

I’ve tried having a hidden element nested inside the XML, assuming the element would be moved by the browser during the cut/paste, but it gets removed.

There is the option to generate an index/hash for each node as an attribute and associate that with an object in memory, but I want to avoid this for usability reasons.

The purpose of this is to slim the XML to make it more readable instead of having lots of attributes.

  • 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-10T13:43:21+00:00Added an answer on June 10, 2026 at 1:43 pm

    Clearly I did not do enough testing. It seems the cut/paste will work as long as you give the element at least one attribute, and you don’t use display:none. I’m now able to have an empty <span> element inside each node that can store a hash in an attribute for associating the node with an object in memory.

    Data added to that element with $('span').data() did not persist after the cut and paste, but that was to be expected, since the browser obviously creates a new element at this time.

    But, I encountered another problem. Using backspace/delete within the node would sometimes remove the element, which is not ideal. I solved this by absolutely positioning the element off the page. It actually now behaves fairly intuitively. The element is removed if you remove the XML wrapping it, but otherwise it persists.

    Note, I only tested this in Chrome (21), so I don’t know this to be working with other browsers. If anyone can share a more elegant solution, please do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a div with contenteditable set. This div contains an inner div like
So in my project i would like have a nice treeview that has images.
I would like to have an AppWidget that designed like this one . Image:
I would like to have a border that is 4px thick pink on the
I would like to have a custom view in my application that consists of
I would like the user to have limited access to controlling certain CSS attributes
I have 9 ImageViews that when onClick each open a colorpicker, I would like
I have a CONTENTEDITABLE div and inside that div I have a CONTENTEDITABLE span,
I have a problem that I would like have solved via a SQL query.
I have a <div contenteditable=true> that I am trying to use to get text

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.