2

I wondered if anyone knew of a jQuery plugin or function that aided in selecting the text of a column for copying to the clipboard.

For example, I have a 4x4 table and a drag my cursor from cell R1C2 to R4C2 - I'm looking only to select the 4 cells of column 2, none of column 1, 3 or 4.

In the image I want only the red, none of the yellow shaded cells.

Example Table Image

Can anyone help?

u01jmg3
  • 712
  • 1
  • 11
  • 31

1 Answers1

2

This is built-in behaviour in Firefox but is impossible in other browsers. This is because Firefox is the only major browser that allows multiple ranges per selection (implemented as one range per table cell). All other browsers restrict selections to a single range and will continue to do so for the foreseeable future.

You could fake it in other browsers:

  • Create your own highlighting mechanism
  • When columns in the table are highlighted, dynamically create a table that is positioned off-screen and contains just copies of the highlighted columns
  • Select the contents of the off-screen table using the built-in browser selection object.
Tim Down
  • 318,141
  • 75
  • 454
  • 536
  • Thanks. Similar question here: http://stackoverflow.com/questions/6349451/non-continuous-selections-in-chrome which you've already answered – u01jmg3 Feb 21 '13 at 12:33