It is nowhere documented, see http://api.jqueryui.com/draggable/#option-revert
It shows that you can supply a function for the revert option, but it doesn't show which arguments this function will receive.
It is nowhere documented, see http://api.jqueryui.com/draggable/#option-revert
It shows that you can supply a function for the revert option, but it doesn't show which arguments this function will receive.
You should learn to read source code when the documentation is not complete/satisfactory. The following invocation:
this.options.revert.call(this.element, dropped)
is on line 6055 in the non-minified jquery-ui.js (and is the first result when you grep for options.revert)
This means that if revert
is a function, it is invoked on the the widget element jquery object1; and it is passed dropped
as the only argument.
dropped
is a boolean value, which indicates whether the current draggable
was dropped on a valid droppable
element; as can be seen a couple of lines above it.
As the comments say: when the droppable
is valid and accepts the dragged element, dropped
holds a reference to the droppable
jQuery DOM element (and thus converts to true
when evaluated as a boolean)
draggable
widget -- is not passed as an argument; it is merely the context within which the function is invoked and is accessible within the function with the this
reference.The only argument the function receives is the dropped
boolean.