开发者

jquery editor problem in dialog

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(){

               开发者_如何学C  $('#dlgEvent').dialog({
                autoOpen: false,
                height: 370,
                width: 470,
                modal: true,
                open : function(event,ui){
                        if(flag){
                            $('#EventDesc').wysiwyg();
                            flag = false;
                        }
                }
              });

            });

Thanks in advance :)


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();             
                  }
            }
          });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜