Reputation:
I have:
'<textarea data-ng-show="modal.showPreview == 'Source'" >'
How can I quote the word Source? I tried single quotes but that does not work.
Upvotes: 1
Views: 185
Reputation: 17194
You can escape the double quotes with Backslash (\)
Your code won't work as intended because, as soon as the browser encounters the first double quote, it will think that the string has finished.
You can refer to this: JavaScript Escape Characters
How about this:
'<textarea data-ng-show="modal.showPreview == \"Source\"" >'
Upvotes: 1
Reputation: 3718
You need to use backslash \
'<textarea data-ng-show="modal.showPreview == \"Source\"" >'
Upvotes: 1
Reputation: 30330
You can use escaped double quotes:
'<textarea data-ng-show="modal.showPreview == \"Source\"">'
Upvotes: 2