How to prevent selecting text on double click?

Alegro picture Alegro · Dec 4, 2012 · Viewed 13.4k times · Source
#btnLeft{
    width:40px;
    padding:2px 5px 2px 5px;
    background-color: #20a0a0;
    border: thin solid #099;
    border-radius:7px;
    text-align:center;
    font-family:"Futura Md BT";
    font-size:large;
    color:#FFF;
}

This is a css button.
When user accidentally makes double click instead of single one, text inside the button becomes selected, i.e. - changes its background color.
How to prevent this selecting on double click ?

Answer

NullPoiиteя picture NullPoiиteя · Dec 4, 2012

try little jquery

 $(element).mousedown(function(){ return false; })

with css try

-webkit-user-select: none;
-moz-user-select: none;
-khtml-user-select: none;
-ms-user-select: none;