試圖刪除正被送回imgUrl的完整URL: 通常返回類似http://localhost/wordpress/wp-content/uploads/filename.jpg 或http://localhost/wordpress/wp-content/uploads/images/filename.jpg刪除完整路徑,文件名保持只
我想去掉一切,除了filename.jpg和回報它到 ahng_photos_upload_image。將所有內容剝離到最後一個正斜槓處。 我怎麼用JQuery來做到這一點?
window.send_to_editor = function(html) {
imgurl = jQuery('img',html).attr('src');
jQuery('#ahng_photos_upload_image').val(imgurl);
tb_remove();
}
txt.substring(txt.lastIndexOf(「/」)+ 1) – 2012-02-19 21:22:33