-3

I want to remove the '' around a String.

e.g. if the String is: 'editor_1003' then I want to output only editor_1003. because I am using multiple CKEditor and I want to get data this type this is coming as string i am getting error

CKEDITOR.instances.editor_1003.getData();

Answer is 
CKEDITOR.instances["editor_1003"].getData();
Neeraj Kumar
  • 133
  • 1
  • 4
  • 1
    does this answer this question https://stackoverflow.com/questions/19156148/i-want-to-remove-double-quotes-from-a-string/19156197 – Faizal Hussain Nov 17 '21 at 09:29

1 Answers1

2

To remove leading/trailing single quote you may use:

var input = "'editor_1003'";
console.log(input);
var output = input.replace(/^'|'$/g, "");
console.log(output);
Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360