捕获 asp:TextBox 的客户端文本更改事件
我有一个包含文本框的表单。弹出窗口将返回一个值并将其放入文本框。当发生这种情况时,我需要填充另一个控件。我尝试过“onChange”但它没有被触发。如何才能实现这一目标?
I have a form that contains a TextBox. A pop up window will return a value and put it into the TextBox. when this happens, I need to populate another control. I tried tried "onChange" but it was not triggered . How can this be achieved?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
onchange
,但这通常不会连接直到框失去焦点。还有onkeyup
,如果您愿意,也可以使用它立即显示新文本。您可以控制填充文本框的窗口吗?如果是这样,那么这是您的最佳路线,因为它是事件的来源,只需通过父页面中的函数从那里调用第三个控制群体。
如果没有基于数字的效果,您可以将事件绑定到
onchange
< /a>、onclick
和onkeyup
来处理所有情况,它会运行一点额外的,但如果它是轻量级操作,无多次运行副作用,并且您想要覆盖您的基础,这是一个可行的选择。You can use
onchange
, but this usually won't wire until the box loses focus. There's alsoonkeyup
, which you want to use if you want the new text immediately.Can you control the window populating the textbox? If so that's your best route, since it's the source of the event, just invoking the third control population from there, via a function in the parent page.
If there are no number based effects, you can bind the event to
onchange
,onclick
andonkeyup
to handle all cases, it'll run a bit extra, but if it's a lightweight operation, no multi-run side-effects and you want to cover your bases, it's a viable option.