Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't jQuery make all functions "live" automatically?

Tags:

jquery

Why doesn't jQuery allow click(), bind() and similar functions to work "live" automatically?

Why do I need to use live("click", functi... if I want to make it work "live", instead of click(function()...? Does live takes more resources?

like image 712
good_evening Avatar asked Feb 22 '26 15:02

good_evening


1 Answers

Funny you should ask that. Someone wrote an entire article answering your question:
http://www.ultimatewebtips.com/why-jquery-live-is-a-bad-option-to-use/

On the surface live and delegate can seem interchangeable. However, they are not. Live has several serious disadvantages and should never be used, and this article will explain why.

The outlined summary is:

  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
like image 122
Ayman Safadi Avatar answered Feb 25 '26 07:02

Ayman Safadi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!