-1

I have a silly question but important for me. How to override ' in document.write in javascript? For example:

      document.write('Sent's Lois');

You see the problem is part Sent's -'s- because javasript considere it as the end Lois'... It is a problem for me I was trying:

       document.write('Lois');
       document.write('s Lois');

But that's not it because you get document.write('Sent s Lois'); and you missing Sent's again..... Any help please......

user3082821
  • 195
  • 2
  • 10
  • "Beside regular, printable characters, special characters can be encoded using escape notation." From [MDN String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) – Givi Jan 27 '14 at 13:02

3 Answers3

2

You need to escape quotes

use \'

document.write('Sent\'s Lois');
Community
  • 1
  • 1
yashhy
  • 2,856
  • 5
  • 31
  • 57
2

You can try

 document.write("Sent's Lois");
Rajesh Dhiman
  • 1,888
  • 1
  • 17
  • 30
1

The term you're looking for is escaping quotes. Use the back-slash to do so:

document.write('Sent\'s Lois');