Firefox ignores option selected=“selected”

前端 未结 20 1472
你的背包
你的背包 2020-11-28 21:59

If you change a dropdown and refresh the page, Firefox seems to ignore the selected attribute.

相关标签:
20条回答
  • 2020-11-28 22:46

    Try giving the dropdown a name.

    0 讨论(0)
  • 2020-11-28 22:49

    For me none of the solutions above worked. I had to explicitly set the selection if none was set:

    if (foo.find(':selected').length === 0) {
        $(foo.find('option')[0]).attr('selected', 'selected');
    }
    
    0 讨论(0)
提交回复
热议问题