validation and tinymce

validation and tinymce

hi to all

I am using jquery.validate.js , simple modal plugin and tinymce. Here is the scenario, first opening of modal window with tinymce is working fine even the validation. But, on the second time or more opening of modal window I could type with the textarea and the validation mouseout is still working fine but the submit button doesn't work anymore. I tried to remove the validate and it worked it out. If anyone could see in live then I would post it.

Any suggestion would greatly appreciated

Thanks in advance

here is the code

$(document).ready(function() {   
   $('.basic').click(function (e) {
      e.preventDefault();      
      $('#basic-modal-content').modal({onShow: function (dialog) {
         tinyMCE.init({
            // General options
            mode : "textareas",
            theme : "advanced",
            setup : function (ed) {
               ed.onKeyPress.add(
                  function (ed, evt) {
                     var y =  tinyMCE.get('test').getContent();
                     $('#rem_char').html(100 - y.length);
                     if (y.length == 100){
                        alert("Your element has exceeded the 100 character limit. If you add anymore text it may be truncated when saved.")
                        return;   
                     }
                  }
               );
            },         
            plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount",
         
            // Theme options
            theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull",
            theme_advanced_buttons2 : "fontselect,fontsizeselect,bullist,numlist,forecolor,backcolor",
            theme_advanced_buttons3 : "",      
            theme_advanced_toolbar_location : "top",
            theme_advanced_toolbar_align : "left",
            dialog_type : "modal"
         });   
         $("#create_school").validate({
            debug: true,
            errorElement: "span",         
            success: function(span) {
               span.text("ok!");
            },                        
            rules: {
               name: {
                  required:true,
                  minlength:5,
               },
            },
            submitHandler: function() {
               var y =  tinyMCE.get('test').getContent();
               alert(y.length);      
               alert("Submitted!");
            }         
         });   
      }});
   });
   $('.close').click(function (e) {
      e.preventDefault();   
      $.modal.close();
   });   
});