Replace using multiple selectors
I've got a TD with a class (ms-vb2) - within that, I have an anchor tag (a)
the Text within the anchor tag is a file name with underscores everywhere you would normally use a space (My_Official_File_Name). I want to replace the underscores with a space.
var val=$(".ms-vb2 a").html();
var val2=val.replace("_"," ");
But it only replaces the first underscore in the text - not all of them.
What am I doing wrong?