var image_field;jQuery(function(i){i(document).on("click","input.select-img",function(e){return image_field=i(this).siblings(".img"),tb_show("","media-upload.php?type=image&amp;TB_iframe=true"),!1}),window.send_to_editor=function(e){imgurl=i("img",e).attr("src"),image_field.val(imgurl),tb_remove()}});