How to remove special character use jquery

Image How to remove special character use jquery

//=========== its for special character remove =========
function special_character_remove(vtext, id) {
// var specialChars = "@!#$%^&*()_+[]{}?:;|'`/><";
var specialChars = $("#security_character").val();
var check = function (string) {
for (i = 0; i < specialChars.length; i++) {
if (string.indexOf(specialChars[i]) > -1) {
return true
}
}
return false;
}
if (check($('#' + id).val()) == false) {
// Code that needs to execute when none of the above is in the string
} else {
// alert(specialChars + " these special character are not allows");
toastrErrorMsg(specialChars + " these special character are not allowed")
$("#" + id).val('').focus();
}
}
//