tags:

views:

21

answers:

1

Hello,

This is my code :-

   $(document).ready(function(){

                 $('#dlgEvent').dialog({
                autoOpen: false,
                height: 370,
                width: 470,
                modal: true,
                open : function(event,ui){
                      $('#EventDesc').wysiwyg();             
                }
              });

As you can see i have used wysiwyg editor for Jquery. If i don't use wysiwyg() after the open event is fired i.e if i use wysiwyg() as soon as document gets loaded wysiwyg() doesn't work. Hence i've kept it after open event is fired. This way it works but once i close the dialog and reopen it, the open event is fired again and so i see two editors, the one first is disabled and 2nd one works correctly. How do i solve this?

You may tell a trick to keep some kind of flag and change the flag after the 1st time open event is fired. But it doesn't work. The 1st time i see editor working properly but 2nd time when i reopen the dialog the editor doesn't work. It appears to be in faulty state and is disabled. I can't type anything in it. How do i solve the issue?

Edit To sum up, even this code doesn't work :-

  var flag = true;
            $(document).ready(function(){

                 $('#dlgEvent').dialog({
                autoOpen: false,
                height: 370,
                width: 470,
                modal: true,
                open : function(event,ui){
                        if(flag){
                            $('#EventDesc').wysiwyg();
                            flag = false;
                        }
                }
              });

            });

Thanks in advance :)

A: 

USE this code

          $('#dlgEvent').dialog({
            autoOpen: false,
            height: 370,
            width: 470,
            modal: true,
            open : function(event,ui){
                  if(! $('#dlgEvent').data('wysiwyg') ){
                      $('#dlgEvent').data('wysiwyg',TRUE);
                      $('#EventDesc').wysiwyg();             
                  }
            }
          });
From.ME.to.YOU
@From.ME.to.YOU :- Nope. It doesn't work. Essentially you true are trying to do the same thing which i did by maintaining flag. It doesn't work, atleast in Mozilla latest version.
Ankit Rathod