1

My onClick event seems to not be firing, I have a button inside a <ScrollView>, and it does not give me any response, so I was wondering if there is a way to track which object was clicked so I could do the styling to make my buttons clickable again.

<Alloy>
<Window class="container">
    <View  class="insideContainer">
        <View layout="horizontal">
            <ImageView id="minLogo" image="/images/homeLogo.png" ></ImageView>

            <ScrollableView id="mainViewInterna">
                <View id="MainWelcomeText" class="MainWelcomeText rowLayout">
                    <Label class="welcomeText">BEM VINDO</Label>
                    <Label class="welcomeText">[ Usuário ]</Label>

                    <View class="button-row" width="200dp" height="200dp">
                        <Label id="logoutButton" class="button" onClick="logout">Log Out</Label>
                    </View>
                </View>
            </ScrollableView>
        </View>     
    </View>
</Window>   
</Alloy>

The Function:

function logout(){
   Ti.API.log('it works');
}
4

1 回答 1

1
var logout = function() {

    $.logoutButton.removeEventListener('click',logout);

    console.log('logout');
};

$.logoutButton.addEventListener('click',logout);
于 2016-02-05T15:31:38.017 回答