Hans Blue
Hans Blue

Reputation: 51

Vertical Selection Using Jquery

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?

Upvotes: 5

Views: 390

Answers (1)

Bogdan Emil Mariesan
Bogdan Emil Mariesan

Reputation: 5647

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.

Upvotes: 2

Related Questions