dhamaso / ufd

Automatically exported from code.google.com/p/ufd
GNU General Public License v2.0
0 stars 0 forks source link

'destroy' method gives error when no id assigned to select #85

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a select in the html:
     <select class='mySelects'>
     <option value='1'>Apple</option>
     <option value='2'>Banana</option>
     <option value='3'>Pear</option>
     </select>
2. Convert it to a ufd:
     $('.mySelects').ufd();
3. (Later on) destroy the ufd:
     $('.mySelects').ufd('destroy');

What is the expected output? What do you see instead?
Expected it to revert all of class 'mySelects' to standard selects.  Instead I 
get both the ufd select and the standard select at the same time, and the 
script (and my subsequent script) stops with an error:
   TypeError: this.labels is undefined
   ...is.labels.attr("for", this.selectbox.attr("id")); //revert label 'for' attribute...
   jquery.ui.ufd.js (line 1018)

What version of the product are you using? On what operating system?
ufd 0.6
Windows 7 SP1
FF 28.0 (haven't tried other browsers).

Please provide any additional information below.
The problem seems to be that the 'destroy' method assumes the select has an id 
assigned.  
A workaround is to assign an id to each select, e.g. change to:
   <select class='mySelects' id='mySelect1'>

Original issue reported on code.google.com by rtjwebs...@gmail.com on 7 Apr 2014 at 2:18