Updating ViewModel OnChange of textbox value instead of OnBlur

1,156 views
Skip to first unread message

Prabin

unread,
Mar 7, 2012, 10:31:07 AM3/7/12
to KnockoutJS
I'm pretty new to KnockoutJS and I love what I've seen so far.
Currently, when an observable property of the View Model is bound to
the text property of the text box (input type=text), the ViewModel
gets updated only on the blur event of the textbox. Is there a way to
update the View Model on the change event of the textbox? I tried
creating a custom binding handler on wiring up the change event
handler on the text box in the "init", but it somehow did not work. Is
this the correct to achieve this goal? Or is there an easier way?
Thanks,
Prabin

Martin

unread,
Mar 7, 2012, 11:42:19 AM3/7/12
to knock...@googlegroups.com
Hm, I thought it got updated onchange (see this). Otherwise, perhaps the documentation regarding the value binding help?

data-bind="value: someValue, valueUpdate: 'afterkeydown'" 
Reply all
Reply to author
Forward
0 new messages