1

At the moment I'm replacing spaces with hyphens

$( "#" + arrVals.join(',#').replace(/ /g,"-") ).show();

How can I also replace / with -

Thanks very much for your time!

1 Answer 1

4

You can just adjust your .replace() regex to check for either a space or a / character, like this:

$( "#" + arrVals.join(',#').replace(/ |\//g,"-") ).show();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.