Superdooperhero
Superdooperhero

Reputation: 8096

What is the difference between jquery .on and ._on

What is the difference between jquery .on and ._on?

When I search the jquery API I only get .on returned. Google also does not return anything helpful. I'm definitely seeing it in code that works though, for example:

$grid._on("click",".gridSave:not(.disabled)", self.saveRow, self);
$grid.on("click",".gridSave.disabled", function(){ return false });

Upvotes: 1

Views: 596

Answers (1)

Ramy M. Mousa
Ramy M. Mousa

Reputation: 5933

_on comes from jqueryui widget _on while .on comes from normal jquery handler functions

both are basically the same thing, they attach event handlers to an element. an example is when an element is clicked

_on( [suppressDisabledCheck ] [, element ], handlers ) Binds event handlers to the specified element(s). Delegation is supported via selectors inside the event names, e.g., "click .foo".

Upvotes: 2

Related Questions