0

I am newbie to jquery and I would like to know the difference between a

$("#element").on("click", function(event){ });

and

$("#element").live("click", function(event){ });

function.

Francesco Montesano
  • 8,485
  • 2
  • 40
  • 64
KTM
  • 858
  • 4
  • 21
  • 43

1 Answers1

0

Well for one $.live() is deprecated as of 1.7.

Also for more details you can check this answer: What's the difference between jQuery .live() and .on()

Community
  • 1
  • 1
DVM
  • 1,229
  • 3
  • 16
  • 22
  • It's better to flag as duplicate than post a redundant answer linking to the duplicate question. – Andy E Mar 21 '13 at 09:53
  • sorry about that, didn't know that it should be marked as duplicate. Also thanks for editing the format – DVM Mar 21 '13 at 09:58
  • So if i create a dom element after the above function , it will work without any problems , i had a bug that sometimes its not working as i have to give the same function right after the dom creation , how is that happened ? – KTM Mar 21 '13 at 10:01