如何知道是否在JavaScript中单击并未点击输入
我试图弄清楚如何知道何时单击输入以及何时未亮声。让我解释一下:
每当您想在输入字段上键入某些内容时,您就会单击输入框,当您不想键入时,单击其他地方并禁用输入字段。
<input type='text'>
在这里,您可以看到,当您单击它时,该字段将启用,当您单击字段以外的其他地方时,它会禁用。
我只想知道该字段何时被禁用/未亮点。
I'm trying to figure out how to know when an input is clicked and when it is unclicked. Let me explain:
When ever you want to type something on an input field, you click on the input box and when you don't want to type, you click somewhere else and the input field is disabled.
<input type='text'>
Here as you can see, when you click on it, the field is enabled, and when you click somewhere else other than the field, it disables.
I just want to know when the field is disabled/unclicked.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信您只是在寻找
onfocus
。阅读有关React事件的更多信息在这里。
I believe you're just looking for
onFocus
.Read more about React events here.
当您单击输入字段焦点事件时。当您失去焦点模糊时,就会解雇事件。
When you click on the input field focus event is fired. When you lose focus blur event is fired.