I have 2 nodesets that have the following contents;
obj1 "<p>the quick <b>brown</b> fox jumped over the fence</p>"
obj2 "<p>the quick <b>brown</b> fox </p>"
I am attempting to match the contents of obj1 with obj2 and then remove the matched nodes to leave behind an object that looks like.
output "<p>jumped over the fence</p>"
Using jquery $.match returns an error and $.find yields no results either, is there any other effective method of doing what I am trying to work out?
Not sure if this fits the requirements, but the variables looks like HTML strings to me, and it looks like you want to compare the string word by word whitout loosing the original main element, and I would do something like:
FIDDLE
FIDDLE as a function to call (seems simpler) !
Should add that this won’t work for something like :
as those strings does not word for word match, all though the second is part of the first etc. but to remove the similar parts of the string in such an event you could always just do :
FIDDLE