I want to write a function where, when I click anywhere in a line (or sentence) in HTML, it will tell me if it is a letter or a space. Is it possible? For example, I click on any place inside this sentence:
<div id='sentence'>The cat in the hat.</div>
Let's say I click on the letter "a" inside "cat". I want him to warn me that I clicked on the character. Say I press spaces between "cat" and "in". I want him to return a warning that I pressed the space bar.
This may seem impossible, but I have one idea: you can click somewhere and check to the left and right of where you clicked (for example, you clicked right between the space and the letter), and if at least one of the characters is space (say left), it should return that you clicked on the space ... would it be easier to implement? I just need some advice.
source
share