Yvision.kz
kk
Разное
Разное
399 773 постов41 подписчиков
Всяко-разно
0
04:06, 01 марта 2012

В IE и opera optgroup и option не скрываются стандартным jquery hide или css display:none

//В IE и opera optgroup и option не скрываются стандартным jquery hide или css display:none

  1. $.fn.hideOptgroup = function() {
  2. this.each(function() {
  3. if ($(this).is('optgroup') && (!$(this).parent().is('span'))) {
  4. $(this).wrap('<span>').hide();
  5. }
  6. });
  7. };
  8.  
  9. $.fn.showOptgroup = function() {
  10. this.each(function() {
  11. if (this.nodeName.toLowerCase() === 'optgroup') {
  12. var p = $(this).parent(),
  13. o = this;
  14. $(o).show();
  15. $(p).replaceWith(o);
  16. } else {
  17. var opt = $('optgroup', $(this));
  18. $(this).replaceWith(opt);
  19. opt.show();
  20. }
  21. });
  22. };

http://work.arounds.org/issue/96/option-elements-do-not-hide-in-IE/

 
0
346
1