Reset dropdown control for default using javasccript

I have a div tag inside a div tag. I have a drop down control bound to database values overflow https://stackoverflow.com/a/212829/

I have a control flag, as soon as I check, then this div tag will be visible, uncheck the div tag to be invisible.

if the user again selects a value in the drop-down menu, for example, "AUZ", if the user checks or deselects the flag, he should always show the first value "--select -"

hope my question is clear

can anyone give syntax how to achieve any help would be appreciated.

thanks

+4
source share
1 answer

In the reset drop-down list, select its first option and set the selected attribute to true.

$("#yourSelectId option:first").attr("selected", true); 
+5
source

Source: https://habr.com/ru/post/1386636/


All Articles