-1

I have a code which replaces the back slashes as empty string

var data = '<strong>Welcome</strong>\(x = {-b';
document.write(data);

I am getting result like this:

Welcome(x = {-b

I am expecting result like this without modifying string value

Welcome\(x = {-b

I used the same string to display in an id as html content.

document.getElementById("test").innerHTML = '<strong>Welcome</strong>\(x = {-b';

It always replacing slashes by empty string. the string.split method did not helped me to solve this

carte
  • 77
  • 1
  • 11

1 Answers1

-1

var data = '<strong>Welcome</strong>\\(x = {-b';
document.write(data);

try this...

Ajay Kulkarni
  • 2,900
  • 13
  • 48
  • 97