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), '' ); }); 

demo


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -