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

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -