How to remove the first slash in my URL with JavaScript
i need to remove the first "/" in my url. As you can see my first value is correct, now i need to do the same to the second url. How can i delete th开发者_如何学Goe first "/"
option=com_content&view=article&id=2&Itemid=2 < CORRECT
/option=com_content&view=article&id=2&Itemid=2 < NOT GOOD FOR ME
Different way
var rawurl = "/option=com_content&view=article&id=2&Itemid=2";
rawurl = rawurl.substr(rawurl.indexOf('/') + 1);
Try this -
var str = "/option=com_content&view=article&id=2&Itemid=2";
str.replace(/\//, "");
Note: In this answer i have assumed you to save this part of url in variable str first.
精彩评论