userimage

Delete first character of a string in Javascript

I written some piece of script in Javascript where I am getting the tagnames through iteration.

var selectedTag = "";

$("[id^=checkbox-]").each(   

    function(index){    

        if(this.checked){   

            selectedTags = selectedTags+","+$(this).val();   

        }   

    }

);

Now I want to remove the comma(first character of the string). Please suggest.

userimage

var s = "0000var";

while(s.charAt(0) === '0')   

s = s.substr(1);


This will remove 0's at the start of the string

Answer is