Reputation: 3209
I have this code here:
<script type="text/javascript">
var catURL = window.location.pathname;
var catTitle = catURL.split("/");
catTitleNew = catTitle[4].replace("-", " ");
alert(catTitleNew);
//this will alert will convert this-is-my-title to this is-my-title
</script>
And I dont think my replace code is working, its only replacing the first "-"
how to I get it to replace all the "-"
?
Upvotes: 0
Views: 55