【发布时间】:2012-03-10 07:58:34
【问题描述】:
尝试删除返回给 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)
标签: javascript jquery wordpress