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

android - Pass an Serializable object in AIDL -

php - Improving script execution time -

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