mongoose00318 Posted April 28, 2020 Share Posted April 28, 2020 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/ Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted April 29, 2020 Share Posted April 29, 2020 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()); Quote Link to comment Share on other sites More sharing options...
mongoose00318 Posted April 29, 2020 Author Share Posted April 29, 2020 I accomplished what I needed. I switched to using this library: https://github.com/google/diff-match-patch Overall, it provided more of what I needed in a much easier to use way. It works great. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.