Passing parameters to Jquery event handler function

Posted on 14-04-2017 by Nadir Latif


Source: http://stackoverflow.com/questions/4897368/how-to-use-a-function-that-takes-arguments-with-jquerys-change-method

To pass a parameter to Jquery event handler, the parameter should be given as first argument to event function. The argument will be passed on as a property of event.data. For example:


jQuery(".selector").change({parameter: value}, function(event){
    user_function(event.data.parameter);
});