Use a “closure”:
$(edit_link).click(function(){ return changeViewMode(myvar); });
This creates an anonymous temporary function wrapper that knows about the parameter and passes it to the actual callback implementation.
More Related Contents:
- Set a default parameter value for a JavaScript function
- How do JavaScript closures work?
- How to receive and maintain values in functions (javascript)
- Pass an extra argument to a callback function
- JavaScript variable number of arguments to function
- Pass a JavaScript function as parameter
- Is there a better way to do optional function parameters in JavaScript? [duplicate]
- JavaScript function aliasing doesn’t seem to work
- ES6 destructuring function parameter – naming root object
- jQuery pass more parameters into callback
- Is it possible to get all arguments of a function as single object inside that function?
- In Javascript/jQuery what does (e) mean?
- What happens if I call a JS method with more parameters than it is defined to accept?
- Multiple arguments vs. options object
- What happens if I call a function with more arguments than it is defined to accept?
- Javascript function challenge add(1,2) and add(1)(2) both should return 3
- Passing parameters to a JQuery function
- Javascript: Get access to local variable or variable in closure by its name [duplicate]
- Pass only the second argument in javascript
- jQuery 1.9 .live() is not a function
- Calling a function every 60 seconds
- Are “(function ( ) { } ) ( )” and “(function ( ) { } ( ) )” functionally equal in JavaScript? [duplicate]
- How to add an object to an array
- Is there a way to create a function from a string with javascript?
- this inside function
- Javascript functions like “var foo = function bar() …”?
- Passing values to onclick [duplicate]
- onsubmit multiple javascript functions
- How to create javascript delay function [duplicate]
- setTimeout not working inside forEach