views:

19

answers:

2

I want to compare 2 text values on a web page and highlight the differences. Can I do this client-side, preferably with jQuery or Prototype?

A: 

I don't know if something is in the framework to do that... you may want to look for a JQuery plugin. It can be done with client-side code, I'm pretty sure that functionality is in neither framework. A JQuery plugin may exist. Either way, it would be very easy to create a reusable plugin of your own to do that... but essentially you'd have to do a character by character comparison yourself.

Brian
A: 

This diff-patch-match library appears to do a really good job:

http://code.google.com/p/google-diff-match-patch/

The project has JavaScript, C#, C++, Python, and Java implementations that all do the same thing.

Mike Sickler