I have an editable div and I need to compare the text being entered into it with its content just before the latest key was typed.
eg : Previous text : Bhumi New text : Bhumik
Here are the K is being typed I should know that a content has changed. This detection needs to be done on the keyPress event .
However when i console.log the html of the div at each keypress then the final console.log is "Bhumi", ie. on the 'k' keypress the content still does not register K. This gets added on keyup only. Anyway that I can detect what the future content might be so that on each keypress I get what i will on keyup???
Also, I am not dealing with just one line but multiple lines.
EDIT ::: I do not need just the character typed. Suppose I have 10 lines and I can predict at each keypress the final content of a line that will be at keyup then on comparing the previous text to the future predicted text i can know on which line the user is typing currently.