You are absolutely right, a disabled property turns the selection field into a black hole. Even the normal Firefox right-click context menu does not work on it.
It looks like your intention is to re-enable the selection box when you click on the shortcut container, just like the disabled state is just for appearance? .. If so, then what if you made the selection box just disabled using CSS opacity?
<style type="text/css"> label.disabled select { opacity: 0.6; filter: alpha(opacity=60); } </style> <script type="text/javascript"> $(function() { $('div.formdiv').bind('click',function() { $('label.disabled',this).removeClass('disabled'); $('input:radio',this).attr('checked',true); $('div.formdiv').not(this).find('label').addClass('disabled').find('select').attr('selectedIndex',0); }).find('label').addClass('disabled'); }); </script> <div class="formdiv"> <label for="CustomerRadio"> <input id="CustomerRadio" checked="checked" name="usertype" type="radio" value="Customer" />Customer </label> </div> <div class="formdiv"> <label for="BusinessPartnerRadio"> <input id="BusinessPartnerRadio" name="usertype" type="radio" value="BusinessPartner" />Business Partner </label> <label> <select id="businessPartnerType" name="businessPartnerType"> <option selected="selected" value="Builder">Builder</option> <option value="InstallDealer">Install Dealer</option> <option value="RepairDealer">Repair Dealer</option> </select> </label> </div>
Test page here: http://www.carcomplaints.com/test/motowilliams.html
Everything seems to work fine in FF3, and I guess Chrome browsers. Unfortunately, in IE7 (I wish I had nickel every time I said this), the selection window loses focus instantly if you press it directly .. something internal in IE related to the opacity filter changing on the selected object. It seems.
Sidebar ... regardless of your problem with the selection turned off for a while: even if you use the "for = ..." syntax on your labels, I donโt think itโs right to use several form elements contained in one label label . If it really is, maybe just not a good idea. The whole idea is to click anywhere in the label, giving focus to the connected form element, so theoretically your selection box (which is the second form element inside the label) should never focus. FF3 handles this correctly - if you try your code without disabling the selection box, you will see a problem.
Hope this helps. The overlay div proposed by the first poster may be a way. I thought I would just try an alternative solution using the same HTML corrected to fix the problem with multiple forms for the label.
source share