I'm using jquery's dbclick() function in order to toggle highlight of the table raw. The problem I'm facing is that whenever I double click the content of the cell is also selected. Is there an easy way to prevent content selection?
My code:
if ($('.tbl_repeat').length > 0) {
    $('.tbl_repeat tr').dblclick(function() {
        $(this).toggleClass('tr_active');
    });
}
Perhaps I didn't make myself clear - I don't want to disable selecting all together - only when the double click occurs - apart from this event everything else should be selectable as usual.
You can try to deny selection via css on element what you doubleclick
.unselectable {
   -moz-user-select     : none;
   -khtml-user-select   : none;
   -webkit-user-select  : none;
   -o-user-select       : none;
   user-select          : none;
}
                        Place the below coding between here (between Head Tags)
<style>
        .unselectable {
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            -o-user-select: none;
            user-select: none;   
        }
    </style>
Put this in between here (between Body Tags)
<p class="unselectable"> your unselectable text here </p>
Just like this..
<!DOCTYPE HTML>
<html lang="en-US">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style>
        .unselectable {
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            -o-user-select: none;
            user-select: none;   
        }
    </style>
</head>
<body>
    <p class="unselectable">
    <span> your unselectable text here </span><br>
    <a href="#" onclick="return false;"> your unselectable link here </a></p>
</body>
</html>
                        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