简体   繁体   English

使用 JavaScript 更新文本框上的值

[英]Update Value on textbox using JavaScript

I have a textbox that you can simply go and do我有一个文本框,你可以简单地 go 做

element.value = 1;

and change the elements value.并更改元素值。

There is a platform called etsy that in order to update a text value for an item quantity you need to click on the box and then click outside in order to submit and officially update the value.有一个名为 etsy 的平台,要更新项目数量的文本值,您需要单击框,然后单击外部以提交并正式更新值。 How is it possible to update the value?如何更新值?

I would recommend using a responsive UI framework like React to accomplish this.我建议使用像 React 这样的响应式 UI 框架来实现这一点。 Here is a Codesandbox link demonstrating how to do this: https://codesandbox.io/s/serene-torvalds-bnk90p?file=/src/App.js这是演示如何执行此操作的 Codesandbox 链接: https://codesandbox.io/s/serene-torvalds-bnk90p?file=/src/App.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM