Avatar of Julian Haines
Julian Haines
Flag for United Kingdom of Great Britain and Northern Ireland asked on

HTML Table

Hi,

Is there a way of stopping people selecting a table on an HTML page?  at the moment I have some text in a table and you can select the whole table using the + handles.

Thanks
HTML

Avatar of undefined
Last Comment
Julian Hansen

8/22/2022 - Mon
James Bilous

I'm not sure what you mean by + handles, but you can apply some css rules (which are browser dependent) on the container in order to stop selection:

https://css-tricks.com/almanac/properties/u/user-select/
skullnobrains

you can convert that table into an image.

you can create a pseudo table using absolutely positioned divs and write the divs in random order so selecting is feasible but the order will be messy.

you can use pagination so only a few lines at a time can be selected

you can add a transparent modal div over the table : this is quite easy to circumvent for power users, but quite efficient if they are limited to easy copy-paste. that would be the easiest to implement by far.
Julian Haines

ASKER
Thanks sounds good it just looks messy when you move over a table and the handle appear.

Julian
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
James Bilous

You can also change the mouse cursor to a pointer using CSS

https://www.w3schools.com/cssref/pr_class_cursor.asp
skullnobrains

if it just "looks messy" the modal is good enough by far. the css might also work, i'm unsure. but then you probably do not want to do this. different browsers will act differently. this is basically not html related.
ASKER CERTIFIED SOLUTION
Julian Hansen

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question