What is the difference between bind(), live(), delegate() and on() in jQuery?
| Method | Status |
|---|---|
.bind(event, fn) | Deprecated since 3.0, use .on() |
.live() | Removed in jQuery 1.9, was the delegated version for the document |
.delegate(sel, event, fn) | Deprecated since 3.0, use .on(event, sel, fn) |
.on() | The one method to use for direct and delegated events |
<p>Page</p>
console.log('on: ' + typeof $.fn.on + ', live: ' + typeof $.fn.live);
Console output
on: function, live: undefined
Learn more about the similar topics:
| Tutorials |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |