Click here to Skip to main content
15,905,563 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using Vue Dropdown Datepicker.
In the documentation it doesn't have the guide how to set selected.
I tried to use javascript DOM .selected on the page that display the data, but it give me error message in console :
[Vue warn]: Error in mounted hook: "TypeError: can't assign to property "selected" on 12: not an object"

TypeError: can't assign to property "selected" on 12: not an object

The dropdown selected. But, because of this error the next javascript codes not work.
Any ideas ?

What I have tried:

This my codes for the javascript DOM:
var birthday = new Date(this.currentUser.user.birthday * 1000);
var day = birthday.getDate();
var selDay = document.getElementById("day").value = day;
selDay.selected = "true";
Updated 24-Sep-20 22:25pm

The message is telling you that selday is not an object. It is the value '12' as returned from the line:
var selDay = document.getElementById("day").value = day;
Share this answer
This is my solution :

var selDay = document.getElementById("day")
this.$set(selDay, "value", day);
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900