SwVitaliy

Untitled

Aug 1st, 2012
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function trueRefreshSelects(sels, vals) {var names = []; sels.each(function(){
  2. var $this = $(this);
  3. var prev = $this.prev();
  4. if (!$this.attr('name')) return undefined;
  5. if (!prev.hasClass('selectArea')) return undefined;
  6. var m = prev.attr('id').match(/\d+$/); if (m.length === 0) return undefined;
  7. var index = m[0];
  8. prev.remove();
  9. var b, d;
  10. do { d = document.getElementById("optionsDiv"+5); b = d != null; if (d) d.parentNode.removeChild(d); } while (b);
  11. var i, str = ''; for (i in vals) { if (!vals.hasOwnProperty(i)) continue; str+= '<option value="{index}">{value}</option>'.replace('{index}', i).replace('{value}', vals[i]) }
  12. $(str).appendTo($this);
  13.  
  14. });
  15. refreshSelects(names);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment