javascript - Remove last element from url -
i need remove last part of url span..
i have
<span st_url="http://localhost:8888/careers/php-web-developer-2" st_title="php web developer 2" class="st_facebook_large" displaytext="facebook" st_processed="yes"></span></span> and need take st_url , remove php-web-developer-2 http://localhost:8888/careers/.
but not sure how that. php-web-developer-2 not won't have / in it. - separated string.
any help!!??
$('span').attr('st_url', function(i, url) { var str = url.substr(url.lastindexof('/') + 1) + '$'; return url.replace( new regexp(str), '' ); });
Comments
Post a Comment