如何防止选择被更改? [英] how to prevent a select from being changed?
本文介绍了如何防止选择被更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想防止在满足特定条件时更改选择而不禁用select元素.
I want to prevent a select from being changed when a specific condition is satisfied without disabling the select element.
推荐答案
尝试一下: JSBin演示
<select id="mySelect" data-value="" onfocus="this.setAttribute('data-value', this.value);"
onchange="this.value = this.getAttribute('data-value');">
这篇关于如何防止选择被更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文