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

标签 html reactjs material-ui

我有下面的 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/

相关文章:

javascript - react SSR : Document is not defined

javascript - 使选择组件多选下拉列表保持打开状态

jquery - 如何使用CSS单击另一个元素时显示一个元素?

javascript - 我的 &lt;script&gt; 应该在我的 <dom-module> 内吗?

javascript - React、contextApi 中 this.context 始终为空

javascript - 我的 React 应用程序的根文件夹与 React-Router 冲突

javascript - 使用 Fuzzy.js 和表格进行模糊搜索? ReactJS

javascript - 如何使用 Material UI 表分页在每页显示正确的行

css - 连续翻转动画css

javascript - 切换导航未打开