Does anyone know of a JQuery plugin which compares two strings and highlights the differences. I’ve tried searching but although there is stuff out there I can’t find a JQuery specific one. An example of a javascript one which does what I want is
The problem with this one is that I want to implement it on a number of different strings at once (1 on each row of a table) which is why I wanted a Jquery one so I could use JQuerys each selector methods
I wouldn’t be looking for a jQuery plugin in your case. jQuery is a framework that helps handling the DOM changes and more, but there are not many string functions in jQuery.
Another one found through Google does almost the same as the one you reference:
http://www.daftlogic.com/sandbox-javascript-compare-differences-between-strings.htm
edit
It seems like the above mentioned script is the same one used by John Resig
thanks for pointing that out danishgoel end edit
Your problem is that you want it to run over a list of items in a table?
You would not need jQuery for the actual check on differences, but you can use a
forloop around it, or a jQueryeachcall around it.Like this HTML:
and this JavaScript:
As you can see, here you use the jQuery
eachon a jQuery selector but you ask a regular JavaScript function. No need for a jQuery plugin to do exactly the same.