检查是否使用jQuery选择了选项,如果没有选择默认值 - Check if option is selected with jQuery, if not select a default

问题:

Using jQuery, how do you check if there is an option selected in a select menu, and if not, assign one of the options as selected. 使用jQuery,如何检查在选择菜单中是否选择了选项,如果没有,则将其中一个选项指定为选中。

(The select is generated with a maze of PHP functions in an app I just inherited, so this is a quick fix while I get my head around those :) (选择是在我刚刚继承的应用程序中使用迷宫般的PHP函数生成的,所以这是一个快速解决方案,而我可以解决这些问题:)


解决方案:

参考一: https://en.stackoom.com/question/cuT
参考二: https://stackoom.com/question/cuT
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章