Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/370.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 与React中的其他输入字段相比,输入字段输入更少数量的条件_Javascript_Html_Reactjs - Fatal编程技术网

Javascript 与React中的其他输入字段相比,输入字段输入更少数量的条件

Javascript 与React中的其他输入字段相比,输入字段输入更少数量的条件,javascript,html,reactjs,Javascript,Html,Reactjs,我有两个名为Budget和Earning的输入值,所以我只想在Budget小于Earning时输入,否则不输入 我应该如何调节它们:我们可以在这里使用三元运算符吗 <BudgetInput value={BudgetInputValue}> <EarningInput value={EarningInputValue}> 您可以在输入元素中使用禁用的道具…并添加如下条件: disabled={BudgetInput >= EarningInput} 您可以直接使

我有两个名为Budget和Earning的输入值,所以我只想在Budget小于Earning时输入,否则不输入

我应该如何调节它们:我们可以在这里使用三元运算符吗

<BudgetInput value={BudgetInputValue}>
<EarningInput value={EarningInputValue}>

您可以在输入元素中使用禁用的道具…并添加如下条件:

disabled={BudgetInput >= EarningInput}

您可以直接使用
disabled={BudgetInput>=earningput}
是的,对。。。thanks@saksh73它将永久禁用文本框,而我希望允许用户编辑并调整该值properly@ZamirManihar它会禁用textbox@Rupam我假设你在用钩子,和
BudgetInput
earningput
是状态,因此在字段上使用
onChange
更改状态变量
BudgetInput
earningput