I am trying to read in the X,Y co-ordinates of a mouse click on a div,
and I can read it using the following
$('#baseboard').click(function(event){
$('#showxy').html("X: " + event.pageX + " Y: " +
event.pageY);
});
what I would like to do is move the function to a separate function
and call it from here, and I tried defining it as
baseboardWasTapped(event) ... but that did not work. Do you have any
ideas on what I should do ?
Thank you,
Amrita
It sounds like you are on the right track. I just tried this out for
myself, and it worked fine. Here is the code that worked for me:
function createBalloon() {
...
// Add the event handler
newBalloon.click(balloonClicked);
}
function balloonClicked(event) {
alert(event.pageX);
}
- Steve