私のWebアプリでは、ユーザーが同じボタンを何度もクリックして、メッセージやものをスキップして、</a>が選択されることがあります。
Javascript(jQuery)を使用してこれを防ぐにはどうすればよいですか
私のWebアプリでは、ユーザーが同じボタンを何度もクリックして、メッセージやものをスキップして、</a>が選択されることがあります。
Javascript(jQuery)を使用してこれを防ぐにはどうすればよいですか
これにはスクリプトは必要ありません。css は次のとおりです。
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
この解決策は私のために働いた:http: //chris-barr.com/entry/disable_text_selection_with_jquery/
$(function(){
$.extend($.fn.disableTextSelect = function() {
return this.each(function(){
if($.browser.mozilla){//Firefox
$(this).css('MozUserSelect','none');
}else if($.browser.msie){//IE
$(this).bind('selectstart',function(){return false;});
}else{//Opera, etc.
$(this).mousedown(function(){return false;});
}
});
});
$('.noSelect').disableTextSelect();//No text selection on elements with a class of 'noSelect'
});