문제

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.

도움이 되었습니까?

해결책

It turns out that the YUI code was in a different scope than that of the <button> and hence why it wasn't responding!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top