1
我創建了一個WordPress的文件上傳插入文件的URL。它就像當我點擊添加媒體按鈕時,它需要我添加媒體上傳。但是,當我選擇圖像時,它不會插入到字段中。我希望每當我選擇圖像並單擊插入按鈕時,圖像URL都應該插入到文本編輯器中。jQuery的window.send_to_editor ..不能在文本字段
var image_field;
jQuery(function($){
$(document).on('click', 'input.select-img', function(evt){
image_field = $(this).siblings('.img');
check_flag=1;
tb_show('', 'media-upload.php?type=image&TB_iframe=true');
window.send_to_editor = function(html) {
imgurl = $('img', html).attr('src');
image_field.val(imgurl);
tb_remove();
}
return false;
});
});
什麼「imgUrl的」必須包含什麼價值? –
它必須像我上傳圖片並點擊插入按鈕時,圖片鏈接應該去文本字段。 – Arshad