jQuery 1.9 .live() is not a function

前端 未结 10 1184
再見小時候
再見小時候 2020-11-22 03:46

I recently updated jQuery from 1.8 to 2.1. I suddenly discovered that the .live() stops working.
I get the error TypeError: $(...).live is not a funct

10条回答
  •  无人共我
    2020-11-22 04:02

    I tend not to use the .on() syntax, if not necessary. For example you can migrate easier like this:

    old:

    $('.myButton').live('click', function);
    

    new:

    $('.myButton').click(function)
    

    Here is a list of valid event handlers: https://api.jquery.com/category/forms/

提交回复
热议问题