Assume I have a page with an input box. The user types something into the input box and hits a button. The button triggers a function that picks up the value typed into the
A one-liner:
var encodedMsg = $('').text(message).html();
See it work:
https://jsfiddle.net/TimothyKanski/wnt8o12j/