Can't get instance of dynamically created ScEditor jQuery plugin

395 views Asked by At

I'm using ScEditor and in normal situations I can get the instance like this, where sceditor is the class name of the textarea element to attach it to:

var instance = $('.sceditor').first().sceditor('instance');

However, I have a situation where I need to create an instance of the editor dynamically.

Creating it dynamically works fine, however attempting to get the instance doesn't work.

The code executes after a click event and on the first click it appears to create the instance fine but I cannot get the instance into a variable and work with it; however if I click the link again, I can now work with the instance, presumably because it now exists before I executed the code.

Is there a way I can get the instance in the same call that the instance is created?

0

There are 0 answers