i'm trying to test some YUI3 examples in a Crossrider App, so i need to create all in a JS file. I dont know if something is added wrong or what is the failure
The code following is on the "extension.js" of the crossrider. After install, debugging in console i get this error: Uncaught ReferenceError: YUI is not defined
THE CODE:
var js = document.createElement("script");
js.setAttribute("src","http://yui.yahooapis.com/3.13.0/build/yui/yui-min.js");
document.head.appendChild(js);
document.body.setAttribute("class","yui3-skin-sam");
var div = document.createElement("div");
div.setAttribute("id","demo");
document.body.appendChild(div);
YUI().use('tabview', function(Y) {
var tabview = new Y.TabView({
children: [{
label: 'foo',
content: '<p>foo content</p>'
}, {
label: 'bar',
content: '<p>bar content</p>'
}, {
label: 'baz',
content: '<p>baz content</p>'
}]
});
tabview.render('#demo');
tabview.selectChild(2);
});
Some help?