Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
I have a contenteditable div

JavaScript
<div id="editableDiv" contenteditable="true">
    hey @twitter is #awesome
</div>


I will collect its html content as $('#editableDiv').html()

html content collected at this time (1): <b>hey</b> <span style="color:blue">@twitter</span> #awesome


html content collected after some time (2): <b>hey</b> <span style="color:blue">@twitter</span> #awesome #website

And now, would like to calculate the differences between (1) and (2) and get the index of different words.
As per this, website is the only word different in (1) and (2) and so
its starting index and ending index must be something like (61, 69)
Posted

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900