Widget:GenderSelector: Difference between revisions
Appearance
Created page with "<Script lang="javascript"> var HelloWorld = { init: function () { // Create a button using OOUI // Note! OOUI is being replaced by Codex var button = new OO.ui.ButtonWidget( { label: 'Click me!' } ); // Bind events button.on( 'click', HelloWorld.sayHello ); // Add the button to the DOM $( '.hello-world' ).html( button.$element ); }, sayHello: function () { alert( 'Hello world!' ); } }; mw.loader.using( [ 'oojs-ui-core' ], HelloWorld.init ); <..." |
No edit summary |
||
Line 4: | Line 4: | ||
init: function () { | init: function () { | ||
var button = new OO.ui.ButtonWidget( { label: 'Click me!' } ); | var button = new OO.ui.ButtonWidget( { label: 'Click me!' } ); | ||
button.on( 'click', HelloWorld.sayHello ); | button.on( 'click', HelloWorld.sayHello ); | ||
$( '.hello-world' ).html( button.$element ); | $( '.hello-world' ).html( button.$element ); | ||
}, | }, |
Revision as of 23:07, 30 January 2025
<Script lang="javascript">
var HelloWorld = {
init: function () { var button = new OO.ui.ButtonWidget( { label: 'Click me!' } ); button.on( 'click', HelloWorld.sayHello ); $( '.hello-world' ).html( button.$element ); },
sayHello: function () { alert( 'Hello world!' ); } };
mw.loader.using( [ 'oojs-ui-core' ], HelloWorld.init );
</script>