Tuesday, March 5, 2013

Passing Events to jQuery Function

$("document").ready(function( ) {

#bind events with chaining

$('#id').bind('mousemove', findMouseCoords)
        .click(event, getEvent);
       
});

function findMouseCoords( event )
{

$("#first-id").html(event.screenX);
$("#second-id").html(event.screenY);

}

function getEvent( event )
{

$("#third-id").html(event.target.nodeName);
$("#fourth-id").html(event.timeStamp);

}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.