jarvis Posted December 21, 2020 Share Posted December 21, 2020 Hi All, I hope someone can help! So I have a basic form which uses Select2. If someone uses the first field, it disables the remaining fields - this works fine. The issue is if you clear the selection in the first drop down, then pick a value from another drop down, it seems to select your choice but also adds 'Select' as an option. I've created a JS Bin to help show the issue: View the JS Bin Any help is appreciated Thanks Quote Link to comment https://forums.phpfreaks.com/topic/311906-issue-with-select2-with-drop-down-including-select-option/ Share on other sites More sharing options...
requinix Posted December 21, 2020 Share Posted December 21, 2020 You have it choose selectedIndex=0. It's not visible but that actually selects the first option - Select. If you want to unselect an option then set selectedIndex to -1. 1 Quote Link to comment https://forums.phpfreaks.com/topic/311906-issue-with-select2-with-drop-down-including-select-option/#findComment-1583314 Share on other sites More sharing options...
jarvis Posted December 22, 2020 Author Share Posted December 22, 2020 @requinix Many thanks, that solved the issue! Have a great Christmas! Quote Link to comment https://forums.phpfreaks.com/topic/311906-issue-with-select2-with-drop-down-including-select-option/#findComment-1583324 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.