<script>
$(document).ready(function(){
$('.delete').live('click', function(e){
alert('delete');
e.preventDefault();
});
});
</script>
<a href='#' id='_1' class='delete'>Delete</a>
Gives me an error:
Uncaught TypeError: Object [object Object] has no method 'live'
I just don't see the problem?
There is a jQuery migrate plugin (use that) ....... it will resolve the issue
ASP.NET MVC ajax-unobtrusive + jQuery 1.9 http://bugs.jquery.com/ticket/13220
See on http://api.jquery.com/live/
old
new
There is one scenario when neither .on(), nor .bind() won't work: when the element does not exist when the event handler is being added. And this was what live() did.
.live()
is a deprecated function (from 1.7+) and removed completely from jQuery 1.9+.You can instead use
.on()
or.bind()
methods:http://api.jquery.com/on/
http://api.jquery.com/bind/
use .on
If you are using jQuery 1.7+ use
on(...)
instead oflive(...)
.Check this: http://api.jquery.com/on/