javascript - How do I detect whether a position is at the beginning of a line in a textarea? -


i have textarea this:

<textarea> test1 , test2 plus test3 </textarea> 

as see, positions in beginning of line: 0 (t), 14 (a), 32 (p).


now need determine whether position (i mean number of position) @ beginning of line?

for example:

10 : false 5  : false 14 : true 40 : false 

how can that?

if want know n-th position @ beginning, then:

n == 0 || $("#textbox").val()[n-1] == '\n' 

Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -