Reputation: 11
I need a YUI3 tabview like
<div id="demo"></div>
<script>
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');
});
</script>
Now need a event handler which will be of following specification
Upvotes: 1
Views: 1824
Reputation: 16705
Just add this below tabview.render('#demo');
tabview.on('selectionChange', function (e) {
alert('Changing tab from "' + e.prevVal.get('label') + '" to "' + e.newVal.get('label') + '"');
}
Upvotes: 4