Reputation: 2269
Im just started to play around with and learn YUI3 however even my very early experiments are failing. Ive made a very simple first script however the page errors on load straight away in firebug with 'B.Lang is Undefined' yui-min.js line 7. Anyone got any ideas?
<html>
<head>
<script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
<title>Untitled 2</title>
<style>
#container{
width: 200px;
height: 40px;
padding: 5px;
text-align: center;
border: 1px solid #ccc;
background-color: #ccc;
}
</style>
<script>
YUI.use('node', function(Y){
Y.one("#container").on('click', function(){
alert("hello world");
});
})
</script>
</head>
<body>
<div id="container">CLICK</div>
</body>
</html>
Upvotes: 0
Views: 1275
Reputation: 3059
You need ()
after YUI:
YUI().use('node', function(Y){
Y.one("#container").on('click', function(){
alert("hello world");
});
});
You'd put a config object in there later if you want control over various aspects, like setting event callbacks, eg:
YUI({
combine: true,
insertBefore: 'insertScriptsBefore',
onProgress: function(o) {
//
},
onFailure: function(o) {
//
},
onTimeout: function(o) {
//
}
}).use('node', function(Y){
Y.one("#container").on('click', function(){
alert("hello world");
});
});
Upvotes: 5