Solution for jquery unobtrusive ajax live error

So you get an error from jquery.unobtrusive-ajax.min.js:

TypeError: $(…).live is not a function?

If you, like me, just upgraded in Visual Studio all NuGet packages included in your MVC project, you may probably encounter this error because the live() function is not available anymore in jquery 1.9, but still being called by .

The problem is that jquery.unobtrusive-ajax.min.js (jQuery Unobtrusive Ajax 2.0.20710.0 at the moment of writing) is calling the live() function in several places.

Here the solution: replace all occurrences of “live(” with “on(“, save and that’s it (source: stackoverflow)

UPDATE

jQuery Unobtrusive Ajax was upgraded and you can use the newest version with the latest jquery 1.x version.

3 thoughts on “Solution for jquery unobtrusive ajax live error

  1. shraddha

    TypeError: $(…).live is not a function
    [Break On This Error]

    $(‘#contains’).live(‘keyup’, function() {

    suppli…?body=1 (line 49)

    Reply

Leave a Reply to Ken Lewis Cancel reply

Your email address will not be published. Required fields are marked *