This removes the last word. How do I get the last word (Stripe)?
var BaseShirtURL = "Base Shirt Draped with Fabric Stripe";
BaseShirtURL = BaseShirtURL.substring(0, BaseShirtURL.lastIndexOf(" "));
alert(BaseShirtURL);
To get the last word:
BaseShirtURL.split(' ').pop();
And to remove the last word you can do this:
BaseShirtURL = BaseShirtURL.replace(/\w+$/,'');