- You can specify an anonymous function as parameter to
- When calling named functions inside
eachyou don’t need the
bindcan be used to bind multiple events to a selection
toggleClasscan be used to force the adding or removing of class.
unbindto unbind events from specific elements
oneexecutes the function only once
event.preventDefault()prevents the default behavior of an element from occuring. For example, links automatically brings you to the page that is linked. If you call this right after the click event of an anchor tag then the default behavior won’t occur,
event.stopImmediatePropagation()prevents the rest of the events from being executed and prevents it from bubbling up the DOM tree,
event.stopPropagation()prevents the parent elements from catching the events binded to a child element. You might have noticed that when you just binded an event to a child element the event is also triggered by their parents.
event.stopPropagation()prevents this from happening.
event.namespacethis is used to separate other from each other. This is a nice way to organize code.
You can actually specify a
titleattribute to a label or any element to act as a tooltip.