0
使用select元素在我的應用程序,我們使用這個模式很多:停用文本選擇,並與Firefox 40
<select name="select" onfocus=this.select; onClick=this.focus();>
<option value="value1" selected>Value 1</option>
<option value="value2">Value 2</option>
</select>
<script>
document.onmousedown = new Function("return false");
</script>
線document.onmousedown = new Function("return false");
旨在防止頁面文本選擇。不幸的是,它也阻止了mousedown事件傳播到select元素。我們使用的workarround是回調onfocus=this.select; onClick=this.focus();
。
我的問題是,它不適用於Firefox 40:單擊選擇框什麼也不做。 (與39正常工作)
我可以刪除行document.onmousedown = new Function("return false");
來修復選擇框,但它會允許在頁面中選擇文本。
我的問題是:我有哪些選項可以同時使用Firefox 40和工作選擇框?
你不能只使用CSS? '-moz-user-select:none;用戶選擇:無;(和任何必需的供應商前綴) – CodingIntrigue
@Rraham Thx,我將重點關注如何處理select元素以搜索其他方式...... –