-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with double digit numbers in multiple select #115
Comments
Sorry, maybe I'm not explaining it accurately, but function getSelectValues(select) {
var result = [];
var options = select && select.options;
var opt;
for (var i=0, iLen=options.length; i<iLen; i++) {
opt = options[i];
if (opt.selected) {
result.push(opt.value || opt.text);
}
}
return result;
}
alert(getSelectValues(document.querySelector('select'))); When using native multiple select everything works correctly - I get the number 15 if I select 15. |
Pull Request is welcome if you find how to fix it, but why don't you use Also note that I didn't create this library and I always use |
The In the "Multiple Select with Jquery" plugin, it works correctly: I think the problem is in the "Multiple Select on js" plugin. |
It would be better if you could help to find the problem instead of just changing library |
found the problem to be that the comparison was done via a substring check instead of a full string value check. However please note that I was able to reproduce the error with the code you provided but I was not able to reproduce with the fixed and released in v0.4.8 |
Thanks! In the "Multiple Select with Jquery" plugin, it works correctly. |
I pushed a new version, I found a regression bug right after the release (the same bug you found I think), you can test v0.4.9 instead, it should be fixed now. You can test it by trying Example - Form Data and clicking the Submit button, then uncheck and check other options and click Submit again, now it's ok. I also added new E2E tests to cover this new issue |
It works! Thank you very match! |
you can upvote the lib if it's helpful ⭐ bye now |
I already voted. |
Hi.
If there are two-digit numbers in multiple selects (example https://ghiscoding.github.io/multiple-select-vanilla/#/example03), then when I select the value 15, the Select has the value 1, 5, 15 (but I only selected 15).
Please fix this bug
The text was updated successfully, but these errors were encountered: