I want to bind a click event on a image variable defined in javascript but i am not sure which selector to use
Eg:-
var image=new Image();
image.src=src;
$("image").click(function());
can someone please tell me the right syntax to do this.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You may find it easier to work with an
imgnode rather than theImageobject itself:Based on your comments, it sounds like you’re trying to bind a click event to an image that’s being transferred to a canvas. In that case, your best bet might be to bind the click event on the canvas and check the mouse coordinates against the coordinates and dimension of the image you’ve transferred.