Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
KnockoutJS Web Development

You're reading from   KnockoutJS Web Development Efficiently work with data, web templates, and custom HTML tags using KnockoutJS

Arrow left icon
Product type Paperback
Published in Feb 2015
Publisher
ISBN-13 9781782161028
Length 178 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
John Farrar John Farrar
Author Profile Icon John Farrar
John Farrar
Arrow right icon
View More author details
Toc

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 $19.99/month. Cancel anytime
Banner background image