This project has moved. For the latest updates, please go here.

Access function from outside element?

Nov 17, 2009 at 12:16 AM

Sample code:

$(function() {
            $("#form_showHTMLview_button").click(function() {
                XXXXXXX.showHTMLView();
            });
        });

 

Basicly... what is XXXXXX?

How do I access the functions?

 

Thanks for a very neat plugin!

f

Mar 17, 2011 at 5:53 PM

I think what you should do is cast the textarea jQuery Object to being of type jHtmlArea Prototype. But i myself haven't completely figured out how to do that yet either.

Mar 17, 2011 at 6:09 PM
Edited Mar 17, 2011 at 7:28 PM

Works now! With a damn workaround. In the loaded method i define my own jQuery namespace and store the object in there using "this".

$('textarea#myTextAreaId').htmlarea({
loaded: function() {
$.myCustomConfig = {jhtmlareaobject : this};
}
});

Then in an outside method i access that namespace and convert it to jHtmlArea:

$.myCustomConfig.jhtmlareaobject[typeof jHtmlArea] = jHtmlArea;
$.myCustomConfig.jhtmlareaobject.pasteHTML('this is just a test!');

Should work for you too.