How to prevent selection in a table
I've used JQuery UI Selectable with a table, w开发者_开发百科hen I use multi selection with Ctrl I have the following problem:
How could I prevent the orginal selection in HTML in the table with keeping JQuery functionality?
I've already tried using user-select: none;
for the table but it hasn't worked!
Any help!
For a fully cross-browser-compatible solution, feel free to use my jQuery noSelect plugin. Here’s a generic demo: http://mathiasbynens.be/demo/noselect
But you could use it like this:
$('table').noSelect();
There is no unified way to make items unselectable that's cross browser ,However ,Each browser seems to have it's own way to accomplish this.
for Chrome and Firefox add these to the css:
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
The last one works for Opera but I'm not sure. As for IE add ' unselectable="on" ' to the HTML tag itself as in <input id="i1" unselectable="on" ..etc
user-select
is not a fully supported by all browsers. Don't depend on this feature.
精彩评论