檢查是否使用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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章