Material-ui: [Checkbox] How to add a custom attribute?

Created on 8 May 2016  路  2Comments  路  Source: mui-org/material-ui

How can I add a custom attribute and get its value within onCheck handler?

Example:

<Checkbox
    label={this.props.label}
    onCheck={this.onCheck}
    checked={this.props.checked}
    labelStyle={{width: 'initial'}}
    data-my-custom-attribute="FOO" // the attribute
/>

onCheck(e, checked) {

    //  How to get the attribute here?
    let foo = e.target.getAttribute('data-my-custom-attribute'); // foo === "FOO"
}
question

All 2 comments

This has to be the worst handling of an issue ever. Gotta remember this guy cause I don't want him on my team.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

chris-hinds picture chris-hinds  路  3Comments

finaiized picture finaiized  路  3Comments

mattmiddlesworth picture mattmiddlesworth  路  3Comments

ghost picture ghost  路  3Comments