Sunday, 16 September 2012

Attaching an event with element using jquery


Bind() is the methode to attach the event

.bind(event type, event handler)

In the following example,
bind attaches the event handler to the click event by selecting all
elements that contain the class
mylink. When the event is invoked, it triggers the alertMe
function:
$
(document).ready(function(){
$
(‘.mylink).bind(click, alertMe);
function
alertMe() {
alert
(“Hello World”);
}
});

enjoy


No comments:

Post a Comment