Home > Web Front-end > JS Tutorial > body text

Disable selected text compatible with IE, Chrome, FF, etc._jquery

WBOY
Release: 2016-05-16 17:23:39
Original
1152 people have browsed it
Copy code The code is as follows:

$(el).attr('unselectable','on')
.css({'-moz-user-select':'-moz-none',
'-moz-user-select':'none',
'-o-user-select' :'none',
'-khtml-user-select':'none', /* you could also put this in a class */
'-webkit-user-select':'none',/ * and add the CSS class here instead */
'-ms-user-select':'none',
'user-select':'none'
}).bind('selectstart', function(){ return false; });

According to the above analysis, you can set the css of the Disable selected text area you need. For example:
Copy code The code is as follows:

.table {
text-align: center;
vertical-align:middle;
height: 39px;
overflow: hidden;
moz-user-select: -moz-none;
-moz-user-select: none ;
-o-user-select:none;
-khtml-user-select:none; /* you could also put this in a class */
-webkit-user-select:none;/ * and add the CSS class here instead */
-ms-user-select:none;
user-select:none;/***/
}
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!