3D-kreativ
3D-kreativ

Reputation: 9299

Can't find source of error in form handling

I'm learning to use forms and Ajax with jQuery, but I didn't came far before I got an error message that I can't solve on my own. In the Chrome developer tool, I get a message that there is no on method!? What have I done wrong?

$(document).ready(function(){

$('form.ajax').on('submit', function() {

//console.log('Working!');
alert("test");
return false;   
});

});

Upvotes: 1

Views: 58

Answers (1)

Praveen
Praveen

Reputation: 56509

on was introduced to jQuery v1.7. Try to upgrade the jQuery library or try using .bind()

$('form.ajax').bind('submit', function() { 
alert("test");
return false;   
});

Upvotes: 4

Related Questions