jquery dynamic setting selected does not take effect
Pit of old projects
Prop must be used, but attr attribute cannot be used otherwise it cannot succeed. For such elements as checkbox, radio and select, the selected attribute corresponds to "checked" and "selected", which are also inherent attributes, so you need to use the prop method to operate to get the correct result.