Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Handling
SUBMITTED BY :
YOGITA, 19071211
What is Event ?
In programming, an event is an action that occurs as a result
of the user or another source, such as a mouse click.
An event handler is a routine that deals with the event,
allowing a programmer to write code that will be executed
when the event occurs.
Other common event
examples
A web browser completely loading a web page.
A file being created or modified on a filesystem.
A hardware sensor such as a webcam or microphone
receiving sensory input.
The arrival of incoming network traffic.
The occurrence of an error at the program or system level.
Event Handling
Event Handling is a software routine that processes actions,
such as keystrokes and mouse movements.
It is the receipt of an event at some event handler from an
event producer and subsequent processes.
Functions of Event Handling
Event Handling identifies where an event should be
forwarded.
It makes the forward event.
It receives the forwarded event.
It takes some kind of appropriate action in response, such as
writing to a log, sending an error or recovery routine or sending a
message.
The event handler may ultimately forward the event to an event
consumer.
Event handling in the DOM
What is DOM?
The Document Object Model (DOM) is a programming API for HTML and
XML documents. It defines the logical structure of documents and the way
a document is accessed and manipulated. Nevertheless, XML presents this
data as documents, and the DOM may be used to manage this data.
Event handling in the DOM
Let's first review (for most of us, at least) the 2 common and
conventional ways of setting up an event handler- via HTML,
or scripting. In both cases, a function or code is attached at
the end, which is executed when the handler detects the
specified event.
1) Via HTML, using
attributes
$(selector).action()
•A $ sign is to define/access jQuery
•A (selector) is to “query (or find)” HTML elements in html page
•A jQuery action() is the action to be performed on the selected elemen
jQuery Selectors
$("a[target='_blank']") Selects all <a> elements with a target attribute value equal to "_blank"
$("a[target!='_blank']") Selects all <a> elements with a target attribute value NOT equal to "_blank"
$(":button") Selects all <button> elements and <input> elements of type="button"
AJAX is the art of exchanging data with a server, and update parts of a web page - without
reloading the whole page.
Method Description
$.ajax() Performs an async AJAX request
$.ajaxPrefilter() Handle custom Ajax options or modify existing options before each request is
sent and before they are processed by $.ajax()
$.ajaxTransport() Creates an object that handles the actual transmission of Ajax data
$.get() Loads data from a server using an AJAX HTTP GET request
Some other jQuery AJAX
methods:
ajaxComplete() Specifies a function to run when the AJAX request
completes
load() Loads data from a server and puts the returned data into
the selected element