tags:

views:

44

answers:

1

how do I take the string using jQuery

Standard Class

and turn it into this

Standard_Class

if this is the id

$('#some_id').text;
+4  A: 

Why do everything needs to be done with jQuery? How about a regex:

var result = 'Standard Class'.replace(/\s/g, '_');

and to modify the text into an existing element jQuery could be useful:

$('#some_id').text($('#some_id').text().replace(/\s/g, '_'));
Darin Dimitrov
Don't mess with their religion, or John will come after you.
jweyrich
This reminds me of a [picture](http://img180.imageshack.us/img180/3305/addanumbertoanothernumb.png) :-)
Darin Dimitrov