Skip to main content

How to display for slash as a string in javascript HTML

You can display for slash as a string in an HTML page while using the javascript onclick method in the input element.

  • Display forward slash (/) as string in HTML page using character escape in Javascript

    <a href="javascript:void(0)" onclick="getVideoFile('video/\*');"> Anchor </a>

    Sometimes you have to pass the forward-slash (/) as a parameter value to the method in HTML. You have to pass the backslash after the forward-slash while passing it as a string to the method in javascript. The backslash (\) escape character turns special characters into string characters.  Here we have to show ('video/*') as a string.

  • Back to code snippet queries related javascript