2

As of post jQuery 1.7 the .live() and .bind() are deprecated and instead of that .on() is being used. Both of these were great functions were working like charm. What is purpose of removal? What is the technical reason behind that?

And why .on() is proffered to use?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Rajan Rawal
  • 6,171
  • 6
  • 40
  • 62
  • possible duplicate of [What's wrong with the jQuery live method?](http://stackoverflow.com/questions/11115864/whats-wrong-with-the-jquery-live-method) – Adil Shaikh Apr 10 '13 at 11:14
  • 1
    I'm saying this quite a lot lately, but `bind()` is *not* deprecated, and neither are `unbind()`, `delegate()` and `undelegate()`. It is recommended to use `on()` and `off()` instead, but you can still use the "older" methods if you want to support jQuery releases prior to 1.7. Only `live()` and `die()` were deprecated, then removed in 1.9. – Frédéric Hamidi Apr 10 '13 at 11:16
  • @MohammadAdil, i know how to use `.on()` instead of `.live()`. Perhaps you have not clearly got my question. – Rajan Rawal Apr 10 '13 at 11:18
  • 1
    The linked question does answer you question IMO: *"Further beauty of .on() is that it streamlines all events"* That's the reason why it is preferred. All event handling is unified. – Felix Kling Apr 10 '13 at 11:25
  • 1
    You need look no further than jQuery's own [`.live()` doco page](http://api.jquery.com/live/) for an explanation as to why it was deprecated. (The jQuery doco is a good first stop for any jQuery questions.) – nnnnnn Apr 10 '13 at 11:32

1 Answers1

1

Quote from this article:

  1. You can’t use live for reusable widgets.

  2. stopPropagate() doesn’t work in live

  3. Live is slower

  4. Live isn’t chainable

Eli
  • 14,779
  • 5
  • 59
  • 77