how do I take the string using jQuery
S开发者_如何学编程tandard Class
and turn it into this
Standard_Class
if this is the id
$('#some_id').text;
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, '_'));
精彩评论