Bug Tracker

Modify

Ticket #13220 (closed bug: duplicate)

Opened 15 months ago

Last modified 12 months ago

jQuery 1.9.0 .live('click')

Reported by: djsucho@… Owned by: djsucho@…
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.0
Keywords: dbr Cc:
Blocking: Blocked by:

Description

jQuery 1.9.0

.live('click', function() { });

console: Uncaught TypeError: Object [object Object] has no method 'live'

Change History

comment:1 Changed 15 months ago by rwaldron

  • Owner set to djsucho@…
  • Status changed from new to pending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket!

Additionally, be sure to test against the "jQuery (edge)" version to ensure the issue still exists—you may need to change this to a specific version depending on the test case.

To get you started, use this boilerplate:  http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to begin.

Also, please read:  http://blog.jquery.com/2013/01/15/jquery-1-9-final-jquery-2-0-beta-migrate-final-released/

comment:2 Changed 15 months ago by djsucho

Hi, sorry for my English released a new version of jQuery 1.9.0 and suddenly everything where I used function .live ('click', function () {}); stopped working

console: Uncaught TypeError: Object [object Object] has no method 'live'

when by change an old jQuery 1.8.3 everything works

jSfidle jQuery 1.8.3  http://jsfiddle.net/qsXeD/

on 1.9.0 alert not pop

comment:3 Changed 15 months ago by anonymous

I believe .live() has been moved from 1.9 to the migrate plugin

comment:4 Changed 15 months ago by mikesherov

  • Status changed from pending to closed
  • Resolution set to duplicate

Duplicate of #13213.

comment:5 Changed 15 months ago by anonymous

HOW CAN YOU FUCKERS RELEASE A VERSION WITH SUCH A MAJOR FAULT!?!??!

comment:6 Changed 15 months ago by gibson042

  • Keywords dbr added

comment:7 Changed 15 months ago by andy@…

According to the API documentation for the live method:  http://api.jquery.com/live/

It was deprecated in version 1.7. That version was officially released on November 3, 2011  http://blog.jquery.com/2011/11/03/jquery-1-7-released/

You've had over a year to prepare for the removal of live. You can of course continue to use a previous version.

comment:8 Changed 15 months ago by dmethvin

I think we've done a pretty good job getting the message out over the past year with blog posts, upgrade guides, and the jQuery Migrate plugin.

Most likely the affected people were either using  http://code.jquery.com/jquery-latest.js or  http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js in their production sites and therefore had the upgrade forced on them. Using these URLs is a very bad idea.

There will always be breaking changes, intentional and unintentional, between versions of software. If you've tested your site and jQuery plugins with version 1.8.3 or some other version then you should stay on that version until you have the time to read the new docs, upgrade, and test again with 1.9.0. By saying "I want the latest version" on a production site you're playing reliability roulette and the house always wins.

comment:9 Changed 15 months ago by anonymous

Guys, please realize that this change has huge implications on a vast number of projects. There are not just individual developers who need to modify their codes, but a large number of third party companies and plugin/library providers are also behind. For example, this morning, after upgrading to version 1.9.0 in our development environment, all of our ASP.NET MVC projects stopped working, not because WE are using "live", but because this function is used even in the latest versions of MIcrosoft's unobtrusive plugins such as "jquery.unobtrusive-ajax.js". So now we are reverting back our update until sometime Microsoft and who knows what other third-party companies gradually convert their products according to this change.

comment:10 follow-up: ↓ 12 Changed 15 months ago by dmethvin

@anonymous, we've been working towards this for a year and publicizing it all on blog posts and documentation. Where were you to register your feedback during that time?

As you've done, you can continue to use 1.8.3 while your other project dependencies catch up. Alternatively you should be able to use the jQuery Migrate plugin to restore the old functionality. That is its purpose.

Clearly we can't just stop making releases and changing things until everyone catches up. We'd never release anything.

Last edited 15 months ago by dmethvin (previous) (diff)

comment:11 Changed 15 months ago by scott.gonzalez

...or you can write the one line of code to re-add .live()...

comment:12 in reply to: ↑ 10 Changed 15 months ago by anonymous

Replying to dmethvin:

@anonymous, we've been working towards this for a year and publicizing it all on blog posts and documentation. Where were you to register your feedback during that time?

As you've done, you can continue to use 1.8.3 while your other project dependencies catch up. Alternatively you should be able to use the jQuery Migrate plugin to restore the old functionality. That is its purpose.

Clearly we can't just stop making releases and changing things until everyone catches up. We'd never release anything.

Don't get me wrong my friend. I appreciate all your hard work, contribution to the community, and so many wonderful innovations. - And yes, I for one have not provided any feedback and contribution to this project whatsoever, but generally, unfortunately this kind of change requires a huge coordination effort, especially for something like jQuery which is now an important part of any non-trivial web-based application. Well, now we'll have to wait and see how this goes and learn some lessons from it for our future. - In any case I would like to thank you guys so much for all your precious and invaluable contributions and efforts.

comment:13 Changed 15 months ago by mikesherov

The migrate plugin keeps .live() around for you. Sorry, there's just too many ways around this to take these complaints seriously.

comment:14 Changed 14 months ago by violapiratejunky@…

What are we supposed to use instead of live? I've seen people say to use "on" instead, however this isn't working for me for what live worked for (elements that were not originally on the page but are dynamically put there)

comment:15 Changed 12 months ago by amoszcz@…

Apparently it is very easy to fix the error in "jquery.unobtrusive-ajax.js". Simply replace all calls to live function using following pattern:

old:

$("form[data-ajax=true]").live("submit",function (evt) {
}

new:

$(document).on("submit","form[data-ajax=true]",function (evt) {
}

For more information go to:  http://www.elijahmanor.com/2012/02/differences-between-jquery-bind-vs-live.html

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.