How To Display Javascript Variable Value In Html Page

,encodeURIComponent does not encode the single quote (apostrophe) because






according to RFC 3986

the apostrophe does not need to be encoded in any part of the URL. (It is a ‘reserved’ character

but carries no special meaning in this context.)