How do I call a basic YUI3 function from within a normal JavaScript function?

Posted by Justin Tanner on Stack Overflow See other posts from Stack Overflow or by Justin Tanner
Published on 2010-06-11T02:16:42Z Indexed on 2010/06/11 2:22 UTC
Read the original article Hit count: 301

Filed under:
|

I'd like to call a simple YUI3 function from within a JavaScript function. Here is some code that does what I want in a very verbose way:

function changeContent (message) {
    YUI().use("node", function(Y) {
        Y.all('#content-div').setContent(message);
    });
}

Is there a better way to do this?

NOTE: I don't want to attach this function to any event, I just want a global changeContent() function available.

© Stack Overflow or respective owner

Related posts about yui

Related posts about yui3