Kanishka Kanishka - 3 months ago 20
jQuery Question

JavaScript trim with character

I have a string like this:

var str=",test,test1,test2,teset4"


How can I remove the ',' in front of the string? So the output will be something like this:

'test,test1,test2,teset4'

Answer

you can try this:

str.substr(1)

var str=",test,test1,test2,teset4"
alert(str.substr(1))

Comments