【发布时间】:2025-11-30 08:35:01
【问题描述】:
我有一个用户需要填写的输入字段。 呈现页面时,我希望输入字段显示没有错误红色边框,因为没有传递任何值,我只想在用户键入一些值然后删除它时触发错误。
我想要的行为
问题,我需要在初始渲染时移除这个红色边框
这里是代码
<div className="ipt-form-group">
<input type="number" required className={this.state.activeCSS} placeholder="Qual a média de faturamento mensal?" min="0" onInput={this.changeView.bind(this)} onChange={this.changeRevenuesState.bind(this)}/>
</div>
<div className="ipt-form-group">
<input type="number" required className={this.state.activeCSS} placeholder="Qual a média de despesas fixas mensais?" min="0" onInput={this.changeView.bind(this),() => this.callbackFunction()} onChange={this.changeAverageState.bind(this)}/>
</div>
【问题讨论】:
-
欢迎来到 Stack Overflow!仅从以上信息我们无法为您提供帮助。请使用 Stack Snippets(
[<>]工具栏按钮)通过 runnable minimal reproducible example 更新您的问题。 Stack Snippets 支持 React,包括 JSX; here's how to do one.
标签: javascript css html reactjs input