use knockout data binding for all dom events.
refactor and bug fix.