I have put an onclick listener on the row element n a table, but when i do click on a row (whilst pressing ctrl), a border appears around the cell i clicked on.
Is there anyway to prevent this?
To select data in the second column of the following HTML table, hold down Ctrl and click the Example 2 cell and drag down to Four. Once selected press Ctrl + C to copy the data, and then Ctrl + V to paste it elsewhere.
Table Border in HTML is used to display a border around the table contents. This can be set around the table by specifying values like 0 for no border is showing around the table cells, whereas value 1 is set to display a border around the table cells.
I found this question looking for the solution myself. I thought I'd share what I found elsewhere that seems to do the trick. Note - this is a firefox issue.
Solution is to add "-moz-user-select: none;" for table elements that you want to disable this behavior.
found at http://support.mozilla.org/en-US/questions/763547
I think you're running into something that Firefox does by default for tables.
This snippet that I found somewhere works for me:
$('table').mousedown(function (event) {
if (event.ctrlKey) {
event.preventDefault();
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With