Is it possible to get all strings after a the first character?
var val = 'asdasd:111122:123123123'; var response = val.substring(val.lastIndexOf(":")+1); alert(response ); // "123123123" // Would like: ":111122:123123123"
Thank you!
Advertisement
Answer
Use indexOf(...)
instead of lastIndexOf(...)
If you want to include the ":"
then do not add one to the index.
Like this:
var val = 'asdasd:111122:123123123'; var response = val.substring(val.indexOf(":")); alert(response); // ":111122:123123123"