Disabling text selection
published 11 May 2006
While trying to make a table behave in an Excel fashion I came across a little problem. I wanted the table to allow the user to select a range of rows with a Shift+Click… The problem is that, by default, the browser will select the page’s text content. This isn’t something you’ll want to do very often but it is possible to get around this:
Firefox can do this from your CSS:
table {
-moz-user-select: none;
}
On the table element IE needs:
the_table_node.onselectstart = function () {
return false;
};
Comment
Quick links
Other people's articles that we think you might be interested in:
- Ajaxian » Web Inspector: Looking good, and profiling nicely
- smush it!
- cssdoc - Trac
- CSS Systems for writing maintainable CSS | Natalie Downe
- The PNG Gamma Dilemma - Trevor Morris Photographics
Want to buy a cheap laptop for your design work? read laptop reviews at laptopical.com