-3

so, I have an anchor that is getting called by replacing the space with a - using the php str_replace, now inside of the javascript hash I want to undo these changes so users will search for the words without these -. any response would be appreciated.

Noam Hacker
  • 4,671
  • 7
  • 34
  • 55
  • 1
    Post your code. – Andy Aug 11 '17 at 14:34
  • question's too unclear and as to the tags used with hardly any supportive code – Funk Forty Niner Aug 11 '17 at 14:37
  • This can only work _one-way_ btw; you can create an URL with a fragment (hash) on the server fine - but fragments aren't sent back up to the server. Apache/PHP will never see `#badgers` in `/i-like.html#badgers` – CD001 Aug 11 '17 at 14:44

1 Answers1

1
var href = "a-b-c";
    href = href.replace(/\-/g,"");

    console.log(href);

Will work and replace all "-" instead one.

You can try here https://codepad.remoteinterview.io/MAZLREUGKE

Dimash
  • 581
  • 1
  • 5
  • 13