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
JQuery Select2 cannot enable after disable #5309
Comments
same here. |
Please refer to this stackoverflow answer: https://stackoverflow.com/questions/21187050/how-can-i-disable-selected-attribute-from-select2-dropdown-jquery In this case, the correct usage should be:
or
according to your needs. If this solves the issue, please close it. |
The |
Same problem here |
I'm getting this issue on Select2 4.0.5. I couldnt change input disabled prop after first enable/disable action, |
Stumbled upon the same issue, the fix that works for me is sending the value as an array: |
For someone who is running into this issue, can you create an example of where this fails in a jsbin? That would make it easier to confirm and later debug the issue. |
I had this issue too using the latest version (4.0.7). Disabling options with the following jQuery (on version 2.2.4) did not cause the widget to update (whereas, it did in 4.0.3, but could not be re-enabled).
Calling the Select2 initialiser again worked around both issues.
|
I've setup a jsfiddle with the working array values This is for the latest select2 version 4.0.7 |
Here's a jsfiddle showing that https://jsfiddle.net/3f1bs2j7/
|
Hello @kevin-brown , |
I cannot reproduce the issue described here in this bug report. I'm totally willing to believe that this used to be an issue, but if nobody can reproduce it on the latest version then I have to assume it has been fixed.
That sounds like a very different issue, one that is being tracked under #4695. |
same issue here |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue still exists |
We need a jsbin where this can be reproduced. |
Here is a JSFiddle demonstrating that when developers attempt to disable an https://jsfiddle.net/3sdbwk5t/3/ To demonstrate the original bug, here is a case that shows when developers are able to successfully disable an https://jsfiddle.net/204qe6nj/ As I am using the workaround I posted, this issue no longer affects me. However, the issue is still valid. |
Still looking for a jsfiddle/jsbin which reproduces the issue where enabling/disabling the Select2 element fails. The issue with individual options within the Here are updated jsfiddles with just the Select2 JS version updated to the latest.
https://jsfiddle.net/8dshba6j/
|
This happens to be wrong, you have to .prop("disabled", false) on select field directly or ajax options grabbing capabilities won't work |
this worked for me. |
I am using Select2 version 4.0.5.
My Code
php
jquery
Explanation
Enable false is working to make the select2 disable. When I want to enable it back, using enable true cannot make it enable back. The alert test inside the if code block is working.
System Details
Mac OS 10.13.5
PHP 7.0.9
Laravel 5.5
The text was updated successfully, but these errors were encountered: