Created
March 2, 2018 20:14
-
-
Save johnhutchins/5403cd24c00549cfee6bb62073700948 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
InputCleaner = function() { | |
var start; | |
start = function() { | |
var onKeyUp; | |
onKeyUp = function () { | |
var text = $(this).val(); | |
if (text.indexOf("<") !== -1 || text.indexOf(">") !== -1 || text.indexOf('"') !== -1 || text.indexOf("'") !== -1) { | |
text = text.replace(/</g, ""); | |
text = text.replace(/>/g, ""); | |
text = text.replace(/"/g, "`"); | |
text = text.replace(/'/g, "`"); | |
$(this).val(text); | |
} | |
}; | |
$(document).on("keyup", "input.k-textbox", onKeyUp); | |
$(document).on("keyup", "textarea.k-textbox", onKeyUp); | |
$(document).on("keyup", "input[type='text']:not('input.k-textbox')", onKeyUp); | |
}; | |
return { | |
start: start | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment