JQuery droppable having a handle drop function with additional parametes

So I understand this is how we normally call a jquery droppable:

$( ".selector" ).droppable({
   drop: function(event, ui) { ... }
})

Is it possible for me to write something like this:

$( ".selector" ).droppable({
   drop: function(event, ui, additionalParameter) { return function(){....} }(myParameter)
});

Answers


As long as the value is a function reference, you can do whatever you like. So yes!

You probably want to capture the event and ui objects, so they need to be parameters in the returned function. So your code would be:

$( ".selector" ).droppable({
   drop: function(additionalParam){ return function(event, ui){...}; }(myParam)
});

Need Your Help

Frustum intersection code returns bad value

c++

I'm implementing some frustum-related code, and the culling test returns nothing even when there are many visible objects. My mathematical support library does not provide plane support or anything...

problem getting json data inside my JqGrid

json jqgrid

I am having problem rendering data in my Jqgrid..My JSON data is in this form