問題:
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