html - Truncate word that comes before hyphen in jQuery -


i curious how truncate word comes before hyphen in word, example:

[jazz] - 1970's blues 

would become...

the 1970's blues 

i know how in php , there many functions make possible in php... curious how work jquery!

you can try following:

var text="[jazz] - 1970's blues"; alert(text.substring(text.indexof("-")+1)); 

Comments