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' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -