Force a disabled MI TextField to be clickable

Viewed 26

I have a TextField that is disabled and I'm updating it with React Hooks useState by changing the value property of the TextField.

  const [employee , setEmployee] = React.useState('')



  <TextField
                fullWidth
                disabled
                value={employee}
                variant="outlined"
                InputProps={{
                    startAdornment: (
                        <InputAdornment position="start">
                            <BackupIcon onClick={handleClick}/>
                        </InputAdornment>
                    ),             
                }}
            />

It's only clickable on the Icon BackupIcon.

How can we make it clickable all over the TextField ?

1 Answers

Have you tried putting the onClick like this:

handleClick: function(e) {
    this.setState({
        textFieldValue: e.target.value
    });
},

 <TextField fullWidth
            disabled
            value={employee}
            variant="outlined"
            onChange={handleClick}
            >
<BackupIcon />
<TextField />
Related