1

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 }); 
1
  • ._on() doesn't exist in jQuery.fn by default where chainable methods reside so might be custom method. Where did you get that from? Is $grid even a jQuery object? Commented Apr 11, 2019 at 18:26

1 Answer 1

2

_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".

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.