-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
How do you select a default option in the select box?
Let's say you use this select box inside a form and when you want to edit the form the value Antarctica must appear already selected in the select box.
One possible solution would be this:
// set value
$("#my_select2_element").select2("val", "Antarctica");
This solution works with a select box static e.g.:
Asia Antarcticabut will not work if the options are created inside a template dom-repeat because every option is inside a template.
Another solution will be this:
{{item.label}}but this will select a value inside the select list options. Still, there will be no value preselected in the select box.
How would you preselect a value in the select box?
Thankx!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels