0

我正在使用 Wordpress Thickbox 尝试重新运行用户想要选择的图像的值(当他们单击“插入帖子”时),但 Thickbox 没有关闭,只是显示为任何空白框。

该字段$('#office-image input#image')存在,并且 Firebug 不会报告任何错误。

我不确定为什么这不起作用,因此需要任何帮助。谢谢。

window.send_to_editor = function(html){

    var image_url = $('img', html).attr('src');

    $('#office-image input#image').val(image_url);
    tb_remove();

}
4

1 回答 1

1
tb_show('', 'media-upload.php?type=image&TB_iframe=true');
window.original_send_to_editor = window.send_to_editor;
window.send_to_editor = function (html) {
    var fileInput = jQuery(fileInput_id);
    if (fileInput) {
        fileurl = jQuery('img', html).attr('src');
        jQuery(fileInput).val(fileurl);
        tb_remove();

    } else {
        window.original_send_to_editor(html);
    }
};

我正在使用上面的脚本,它工作正常

于 2012-12-21T12:11:00.097 回答