gpt4 book ai didi

html - autoComplete "on"在 ReactJs 表单中不起作用

转载 作者:行者123 更新时间:2023-12-05 06:23:24 24 4
gpt4 key购买 nike

我有下面的 react 形式,我需要实现“autoComplete="on",这样下次如果用户想要输入相同的值,它应该被建议为自动完成。下面是我的代码

<form className={classes.container} noValidate>
<Grid container item xs={12} alignItems="center">
<TextField
id="outlined-bare"
className={classes.textField1}
defaultValue=""
margin="normal"
variant="outlined"
autoComplete="on"
InputProps={{ style: { height: 40 } }}
onChange={(e) => handleChange(e, 'Name')}
/>
</Grid>

正在渲染的组件是 Chrome 浏览器。这里有什么问题或缺失?

最佳答案

这是下面的代码。您可以在表单标签中添加 autoComplete="on"

<form className={classes.container} noValidate  autoComplete="on">
<Grid container item xs={12} alignItems="center">
<TextField
id="outlined-bare"
className={classes.textField1}
defaultValue=""
margin="normal"
variant="outlined"
autoComplete="on"
InputProps={{ style: { height: 40 } }}
onChange={(e) => handleChange(e, 'Name')}
/>
</Grid>
</form>

关于html - autoComplete "on"在 ReactJs 表单中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58377393/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com