Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
KnockoutJS Web Development

You're reading from  KnockoutJS Web Development

Product type Book
Published in Feb 2015
Publisher
ISBN-13 9781782161028
Pages 178 pages
Edition 1st Edition
Languages

Event binding


Let me start off by saying that I have not tested every type of event that can be bound to Knockout, but there are tons of events in HTML, or rather DOM, that can be tested. It seems with HTML5-friendly browsers the number of the browsers available to us has increased. I would suggest that you make sure that you test to validate if any newer events are actually available on the platform you are targeting.

When we bind an event it requires a handler. These handlers are either functions or methods on objects. The functions can be part of the ViewModel or external to the scope of the ViewModel. As a reminder, when functions are part of the ViewModel we can assign the function method without ( ). If we are passing arguments then we would, of course, use them, even if they were part of the ViewModel.

Common events we would look for in the View would include click, keypress, mouseover, and mouseout. There are many other events, but that is enough of a list to give you an idea of what...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}