How to select HTML content and save it in a database for future workloads

I am trying to highlight selected text content by a user inside an HTML page loaded using PHP + XSL transform. I saw some solutions related to highlighting the currently selected text, but I need to save some information in the database , which allows me to select the same content for future downloads on the same page , taking care of all the internal elements that may have text inside .

The idea is simple: simulate when you use a marker inside a book .

Any ideas? Any suggestion would be appreciated.

Thanks in advance.

Isaac

+3
source share
1 answer

Use AJAX.

http://www.w3schools.com/Ajax/Default.Asp

IMO, DOM location and STRING range.

sort of,

DOM_LOCATION: div[0]>p[2]>span[1]
STRING_RANGE: 2:20

this means that the user of the line allocated from the 2nd character to the 20th character of the 2nd interval of the third paragraph of the 1st div, which is " monstration of some " from the example below.

<div>
    <p>This has no use.</p>
    <p><em>And so is</em> this one.</p>
    <p><span>This</span> is the <span>demonstration of something wonderful</span>.</p>
</div>

All you have to do is change the location of the DOM and use the range.

0
source

Source: https://habr.com/ru/post/1760357/


All Articles