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
Post a Comment