Passing variable with single quote in javascript

后端 未结 6 1053
南方客
南方客 2021-01-27 06:25

I have an onClick call on a link:

 //this is working good

The problem is the variable insid

6条回答
  •  悲哀的现实
    2021-01-27 06:34

    You can escape the quote with a backslash..

    fomateName('Andrew D\'souza');
    

    This should work anyway:

    var name = "Andrew D'souza";
    fomateName(name);
    

提交回复
热议问题