Options that are dynamically set to 'disabled' via jQuery are not working in JQM
Hello. I am utilizing the following code as part of my JQM application:
- <script type="text/javascript">
- $(function () {
- var selects = $('select.magic-select');
- $(selects).bind('change', function (evt) {
- var newVal = $(this).val(), oldVal = $(this).data('old-val');
- if (newVal != 0) {
- $(selects).not(this).find('option[value="' + newVal + '"]').attr('disabled', 'disabled');
- }
- $(selects).not(this).find('option[value="' + oldVal + '"]').removeAttr('disabled');
- $(this).data('old-val', newVal);
- });
- });
- </script>
Basically, it disables values in multiple (other) select menus when selected in the first menu. It works fine when jQuery Mobile is not utilized, but as soon as I enable jQuery mobile, it stops working and users are able to select the same option for all of the available dropdowns (which we are trying to prevent).
I took the code to do this from a Stack Overflow posting, so I am unsure what piece is causing the conflict.
Currently on JQM 1.2.0. Thanks in advance for any assistance you can provide!