Get content after last / in javascript or jQuery -


how can use javascript (or jquery) number value on end of url? number multiple places whole (e.g 1-100)

http://localhost/mysite/#portfolio/1 returns 1 http://localhost/mysite/#portfolio/12 return 12 http://localhost/mysite/#portfolio/12556456 returns 12556456 

use .split() possible

var str = "http://localhost/mysite/#portfolio/333"; alert(str.split('/').pop()) 

fiddle


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -