Skip to content

Instantly share code, notes, and snippets.

@samalba
Created May 1, 2012 00:11
Show Gist options
  • Save samalba/2563872 to your computer and use it in GitHub Desktop.
Save samalba/2563872 to your computer and use it in GitHub Desktop.
javascript safe escape
var escapeInput = function (str) {
return str.replace(/['"<>]|^\s+|\s+$/g, '');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment