在下拉菜单中禁用所选值 [英] Disable the selected value in drop down menu

查看:217
本文介绍了在下拉菜单中禁用所选值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个下拉菜单。它存储月,1月 - 12月。用户可以选择下拉菜单中的任何值,只能选择一次。意思是说,以前他选择Jan,如果他下次登录/输入新记录,他不能选择Jan,也可以永久地删除这个月。一旦他选择了这个月份,它就会存储在其他页面的会话中。所以,如果你有任何想法,建议或计划,毫不犹豫地离开你回答这里。谢谢。

解决方案

以下是您正在寻找的三个工作示例:



使用jQuery:



http:// jsfiddle.net/wLNZX/



使用纯JavaScript:



http://jsfiddle.net/wLNZX/1/



编码与< select> 标签一致:



http://jsfiddle.net/wLNZX/2/


I have this drop down menu.It stores month, Jan-Dec. User can choose any value of the drop down menu but just one time only. Meaning, lets say previously he choose Jan, the next time if he logged in/ enter new record, he cannot choose Jan anymore or maybe remove the month permanently. Once he select the month, it will be store in session to other page. So, if you guys have any idea,suggestions, or plans, dont hesitate to leave ur answer here. Thank you.

解决方案

Here are three working examples of what you're looking for:

Using jQuery:

http://jsfiddle.net/wLNZX/

With plain JavaScript:

http://jsfiddle.net/wLNZX/1/

Coded inline with the <select> tag:

http://jsfiddle.net/wLNZX/2/

这篇关于在下拉菜单中禁用所选值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆