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?
You can use onchange
, but this usually won't wire until the box loses focus. There's also onkeyup
, 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
and onkeyup
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.
精彩评论