Jump to content
mongoose00318

JsDiff & Highlighting Differences Between Table Cells

Recommended Posts

Hello,

I'm using the JsDiff library and trying to compare each cell in a row to it's corresponding cell in the next row; then highlight the differences in the 2nd cell from the first cell. This is how far I've come...

https://imgur.com/a/bCuEpUH

The problem is I need it to highlight where the difference is; not just the entire cells contents. Also, when I set it up in jsFiddle it's not working as it does on my end. I think it's a different version of JsDiff but not sure.

Here is my jsFiddle: https://jsfiddle.net/7fhunqde/6/

Share this post


Link to post
Share on other sites
10 hours ago, mongoose00318 said:

when I set it up in jsFiddle it's not working

if you check your browser's developer console, you will find out why. the diff.js CDN needs to use https

there also may be a version difference. the object is just named Diff, so the JsDiff in the following produces an error, which can be seen in the developer console as well -

var diff = JsDiff.diffChars($(this).text(), cellBelow.text());

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.