Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Multiple instances with modals #208

TheBrockEllis opened this Issue · 0 comments

1 participant


I'm using this editor as part of a blog. In the blog, the article in question is being edited in a Bootstrap modal box. The modal has a bunch of and a for the main content. These form elements were being populated with AJAX data when the modal appeared. </p> <p>I was having a problem about editing multiple blog posts in succession. Every time I opened a modal, the editor would be initialized and I'd get another editor bar show up.</p> <p>I noticed that when the editor is initialized, a hidden input named = "_wysihtml5_mode" was created and given a value="1". To make sure the editor was only fired once, I just made sure that the value of that hidden input != 1.</p> <pre><code>$.ajax({ url: url, success: function(data){ var obj = jQuery.parseJSON(data); $('#editpost_id').val([0].PostID); $('#editpost_title').val([0].Title); $('#editpost_content').val([0].Content); $('#editpost_slug').val([0].Slug); var already = $('div#editpost input[name="_wysihtml5_mode"]').val(); if(already != 1) $('#editpost_content').wysihtml5(); } }); </code></pre> <p>Just wanted to share this in case anyone else was wondering it, but I was also curious to know if there was a better way to go about making sure the editor is only initialized once.</p>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.