I always see this in the documentation.
$('.selector').draggable({
start: function(event, ui) { ... }
});
In the jQuery documentation, what does “event” and “ui” represent and how can I use them?
Is there any way to pass the specific .selector object itself into the function?
I guess I don’t quite understand how this whole thing works without any examples.
I appreciate any help!
When it comes to jQuery, you need to embrace looking things up in the documentation, as for the most part it is pretty complete and will give you anything you need.
With that in mind, this is the documentation: on Draggables:
As far as the event object, here’s the documentation for that.
The most common usage of the event object is to prevent the default action. So if you have a link:
And you want something to happen when the user clicks on it and has Javascript enabled, you might do:
The problem here is that after the alert shows up and you close it, the default action of the link (“go to another page”) is going to happen and the user will be sent to
more.html. A lot of the time this isn’t what you want, so you then prevent the default action: