get text from textarea

I’m a beginner, if suddenly someone helps me, I’m ready to pay a donation.

I need to get the text (code) from textarea (codemirror is used) and compare it with the pre-prepared code. If the code is the same, the background of the code line should turn green, the line that does not match should light up red.