$(document).keydown(function(e){
if (e.keyCode == 37) {
return false;
}
});
$(".direction").click(function() {
var direction = $(this).text();
When I click on a button with .direction class the second function above is called. When the left key is pressed I want to call the $(".direction").click(function() { But with a value (Instead of the var direction = $(this).text(); part) It would be var direction = value passed to function;
How can I do that?
Add another function that is used by both methods: