Reputation: 31
How to change
$.fn.ajaxFormPostLink = function() {
this.live('click', function() {
var $this = $(this);
...
to somenthig using .on()
not .live()
, i tried:
$.fn.ajaxFormPostLink = function() {
$("body").on('click', this, function() {
var $this = $(this);
...
but id does not work, so how to change live()
to on()
in jQuery plugin.
Upvotes: 3
Views: 93
Reputation: 95023
Rebuild the plugin to be used this way:
$.ajaxFormPostLink(".someform",{... options ...});
for example:
$.ajaxFormPostLink = function(selector,options) {
$(document).on("click",selector,function(){
...
});
};
Upvotes: 3
Reputation: 56467
Try this:
$("body").on('click', this.selector, function() {
Assuming you are dealing with simple jQuery object.
Upvotes: 1