jQuery - selected attribute on options doesn't show in FireBug

前端 未结 1 1130
独厮守ぢ
独厮守ぢ 2021-01-14 23:46

Why?

when I select a option in a select field, the selected=\"selected\" attribute still stays on the previous option. But visually you can see that the

相关标签:
1条回答
  • 2021-01-15 00:04

    Selecting an option from the dropdown doesn't modify the selected attribute in the DOM. But if you query the current value using $('#selectId').val() it would return the value of the currently selected option.

    0 讨论(0)
提交回复
热议问题