r2719 - associated the form label's "for" attribute with new selectmenu's ID.

r2719 - associated the form label's "for" attribute with new selectmenu's ID.


Author: scottjehl
Date: Fri Jun 12 07:30:46 2009
New Revision: 2719
Modified:
branches/labs/selectmenu/ui.selectmenu.js
Log:
associated the form label's "for" attribute with new selectmenu's ID.
Modified: branches/labs/selectmenu/ui.selectmenu.js
==============================================================================
--- branches/labs/selectmenu/ui.selectmenu.js    (original)
+++ branches/labs/selectmenu/ui.selectmenu.js    Fri Jun 12 07:30:46 2009
@@ -40,7 +40,8 @@
            
        //make associated form label trigger focus
        $('label[for='+this.element.attr('id')+']')
-            .click(function(){
+            .attr('for', this.ids[0])
+            .bind('click', function(){
                self.newelement.focus();
                return false;
            });    
@@ -199,8 +200,10 @@
    destroy: function() {
        this.newelement.remove();
        this.element.show();
-        //unbind click on label
-        $('label[for='+this.element.attr('id')+']').unbind('click');
+        //unbind click on label, reset its for attr
+        $('label[for='+this.newelement.attr('id')+']')
+            .attr('for',this.element.attr('id'))
+            .unbind('click');
    },
    
    _closeOthers: function(){