diff --git a/wysiwyg.js b/wysiwyg.js
index 4e566db..290b8a7 100644
--- a/wysiwyg.js
+++ b/wysiwyg.js
@@ -194,7 +194,11 @@ Drupal.behaviors.attachWysiwyg = {
       }
       var form = this;
       $('.wysiwyg:input', this).each(function () {
-        Drupal.wysiwygDetach(form, this.id, 'serialize');
+        var id = this.id;
+        if(!id){
+          id = $(this).prev().attr('id');
+        }
+        Drupal.wysiwygDetach(form, id, 'serialize');
       });
     });
   },
@@ -212,7 +216,11 @@ Drupal.behaviors.attachWysiwyg = {
       wysiwygs = $('.wysiwyg:input', context).removeOnce('wysiwyg');
     }
     wysiwygs.each(function () {
-      Drupal.wysiwygDetach(context, this.id, trigger);
+      var id = this.id;
+      if(!id){
+        id = $(this).prev().attr('id');
+      }
+      Drupal.wysiwygDetach(context, id, trigger);
     });
   }
 };
