You can define a small plugin that provides you with the old live function by calling on , but that will only allow you with worse code. You need to reorganize your code to use on correctly.
A solution that helps you ease the initial change will be easier to use the regex for replacement. Most text editors can let you do this.
In case of use, you can use this (example in JavaScript, adapt for your editor):
var output = input.replace( /\$\(\"([^\"]+)\"\)\.live\(\"([^\"]+)\"/g, '$(document.body).on("$2", "$1"' );
Entrance:
$(".item").live("click",function(){ alert("test"); }); $(".item2").live("change",function(){ console.log("test"); });
Output:
$(document.body).on("click", ".item",function(){ alert("test"); }); $(document.body).on("change", ".item2",function(){ window.top.console.log("test"); });
After this initial conversion, you will have to look for better parent elements than document.body .
source share