简体   繁体   中英

Knockout update computed value after blur

I have bound an observable to one input and I would like to trigger observable value update after input looses focus . In this simple fiddle http://jsfiddle.net/wj11c26c/ . you can see that it behaves kinda strangely. If you try to delete (backspace) characters in it will work, but when you change the actual number, eg 1000 to 100 it will immediately update its value to 100 € .

I have tried to use valueUpdate with blur but it keeps updating...

How can I trigger value change after blur?

Use a value binding instead of a textInput binding when you don't want the immediate character by character updates that textInput provides:

<input class="form-control input-lg pull-right hidden-xs" 
       data-bind="value: totalFormat" />

http://jsfiddle.net/wj11c26c/1/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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