Monday, September 26, 2011

Replacing space with underscore in Javascript

I tried providing a title for a custom javascript dojo component but it took only the first word i guess this was because space was not being handled properly so i searche dfor javascript code to replace space with &nbsp. Following is the code

.split(' ').join('_')

No comments: