qcum7a
Last Updated: February 25, 2016
·
366
· txshon

[ Tips ] My Meteor works and I don't know why

I was trying to let the Summernote plugin work after clicking a button.
The class was hiding inside a {{#if}} expression and I was hoping the div can work after the click action.

I finally find out using the setTimeout will make this work!

setTimeout(function(){
      $('.editor').summernote({
            height: 286,
            toolbar: [
              ['style', ['style']],
              ['style', ['bold', 'italic', 'underline', 'clear']],
              ['fontsize', ['fontsize']],
              ['para', ['ul', 'ol', 'paragraph']],
              ['height', ['height']],
              ['color', ['color']],
              ['insert', [ 'link', 'picture', 'video']],
              ['table', ['table']],
              ['view', ['codeview']],
              ['help', ['help']]
          ]
        });

  },0);

Can anyone tell me why this works?

and why .ready doesn't?

@Andy