5
votes

I have a weird requirement and I don't know how I able to achieve it.

I have a textarea which contains the text like

text1 text2 text3 text4 text5 text6 text7 text8
text1 text2 text3 text4 text5 text6 text7 text8
text1 text2 text3 text4 text5 text6 text7 text8
text1 text2 text3 text4 text5 text6 text7 text8
text1 text2 text3 text4 text5 text6 text7 text8
text1 text2 text3 text4 text5 text6 text7 text8
and so on..

Now I want to make a selection using mouse only on text3 column. Can it be possible? In Ms word we used to do it by pressing Alt key. But is it possible to make vertical selection in web component?

1
Is it always a space between the columns and a new line for rows? - Simon Edström
No space can be one or more depending upon the nature of the content.. - Hans Blue
Ok, but could you say that you always want to select word number N (in this case 3)? - Simon Edström

1 Answers

2
votes

Well you could achieve something like when the user clicks check the select column have:

$('tr').find('td:eq(2)')

Select all td's in the third column (not sure if it's 0 or 1 based but i guess 0); Then you can also let's say add some css class to make it appear that those columns are selected and also grab the data.

EDIT:

For a textarea not sure how you could do that.