All technological notes.
Event
Syntax:
$(selector).eventName(function () {});
| Event Method | Event Description |
|---|---|
$(document).ready() |
document is fully loaded |
| Event Method | Event Description |
|---|---|
.on(event, handler) |
Attach an event handler function |
.on(eventsObject) |
Attach multiple event handler functions |
.off(events) |
Remove an event handler |
.trigger(eventType) |
Execute all handlers |
// add an event handler
$(selector).on("eventName", function () {
// code block
});
// add multiple event handlers, event name without quotation
$(selector).on({
eventName1: function () {
//event1 code
},
eventName2: function () {
//event2 code
},
});