It turns out that the YUI code was in a different scope than that of the <button>
and hence why it wasn't responding!
YUI: Button on: click not being called when expected
-
30-07-2022 - |
Domanda
I am trying to create a YUI 3 button that is associated with an html <button>
with the id #createSubAccountBtn
. The html bit is as follows:
<button id='createSubAccountBtn'>Create Sub Account</button>
And JS/YUI3 that is supposed to handle and render a YUI button for that id looks like the following:
var createSubAccountBtn = new YUIRef.Button({srcNode: '#createSubAccountBtn', on: {
'click': function(){
alert("Made it to YUI button definition");
newSubAccountClicked();
}
}}).render();
I don't really understand why the alert I wrote is not being executed after I click the corresponding <button>
tag in my document.
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow