niche Posted December 8, 2011 Share Posted December 8, 2011 I have a javascript variable var newLink = "Bob "; which comes from a xmlhttp.responseText. I could clean-up the string in my php script. I could also slice at " ,", but I'd like to know how to trim "Bob " with js. How is that done? Link to comment Share on other sites More sharing options...
dsonesuk Posted December 8, 2011 Share Posted December 8, 2011 If it is a single word just put it through slice and join again txt = txt.split(' ').join(''); Link to comment Share on other sites More sharing options...
niche Posted December 8, 2011 Author Share Posted December 8, 2011 Thanks dsonesuk. It's hard to how when there's a tailor made method and when some assembly is required as I learn javascript. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.