if i have 1 option selected it consoles logs right id. If i have multiple then it shows always the same value for each selected
Without seeing the code you are trying, I have no idea.
let selectValue = node.selectValue;
let e = $("#node-input-options")[0];
let sel = e.options[i][e.selectedIndex].id;
for (let i = 0; i < options.length; i++) {
node.selectValue = sel[i];
console.log(node.selectValue);
}
This is in oneditsave function. Without the loop if i select only 1 option everything works fine
You don't appear to have read the stackoverflow post I shared.
To get the list of selected values you can do:
node.selectedValue = $("#node-input-options").val()
At which point, node.selectValue will be an array of the selected values.
I'm not 100% sure what that will do if you only have one element selected - you'd have to test to see if it always returns an array or not.
Now, if you're changing node.selectValue to be an array, rather than a single value, you'll have to change the oneditprepare code to handle it being an array as well.