How to add single quote in the variable in Javascript?

I think that you want the semicolon outside the string literal:

var quote_str = '<option value="1">tea</option>';

If you mean that you want apostrophe characters inside the string also, you can use \' to put an apostrophe in a string delimited by apostrophes:

var quote_str = '\'<option value="1">tea</option>\'';

You can also use quotation marks to delimit the string. Then you don't have to escape the apostrophes, but you have to escape the quotation marks:

var quote_str = "'<option value=\"1\">tea</option>'";

If you already have a string, and want to add apostrophes around it, you concatenate strings:

var quote_str =  "'" + str + "'";

Escape each single quote with a back-slash:

var quote_str = '\'<option value="1">tea</option>;\''

…or wrap the string in quotes of a different kind (i.e. double quotes), but be sure to escape the inner double quotes as to not unintentionally close the string:

var quote_str = "'<option value=\"1\">tea</option>;'"

late update: now we have template literals, so the whole thing becomes a breeze:

var quote_str = `'<option value="1">tea</option>;'`

You can escape characters in Javascript with the \. If that's your issue