How to bind event to element in pure javascript:
This is what JQuery does, how do you accomplish it with pure javascript?
$('#arrow_left')
.bind('click', {'c_index': c_index - item_limit },
function(e)
{
var r = e.data.c_index;
}
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 would use element.AddEventListener
And in IE’s case (prior to IE9) you would use attachEvent.
Like this:
JS:
See the demo:
http://jsfiddle.net/E8nYr/2/