Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 694
Hans Blue Avatar asked Nov 04 '22 02:11

Hans Blue


1 Answers

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.

like image 200
Bogdan Emil Mariesan Avatar answered Nov 10 '22 15:11

Bogdan Emil Mariesan