Reputation: 438
When I try to get the character from a textarea text it comes between quotes but when I evaluate him on console it appears like '↵' how to compare those values?
Upvotes: 1
Views: 70
Reputation: 28583
You can execute a bit of a trick to compare the values. Check for the character and replace it with the character code if found.
See snippet example:
var vltest = document.getElementById("test1").innerHTML;
var newString = vltest.replace(/↵/g, '↵');
alert("Old: " + vltest + " New: " + newString); //you can comment this out, just for demo purposes to show before/after
if (newString.indexOf('↵') > -1) { //check if found
alert("Found it!")
}
<textarea id="test1">↵</textarea>
The 'downward left' arrow also has codes of ↵
and ↵
- just a piece of trivia. Feasibly you could replace the arrow with something else (other than the afore-mentioned codes), for instance a <span>
tag or a non-breaking space, and then check for the index of it, but this way works..
Hope this helps
Upvotes: 1