Char Code Test
by amindunited
HTML
<form>
<input name="cheese" id="cheese"/>
<div id="output"></div>
<hr/>
<div id="output2"></div>
</form>
JavaScript
$(function(){
$('#cheese').on('keypress', function(e){
$("#output").html(e.charCode + " - OR - " + $(this).val());
});
$(document).on('input', '#cheese', function(e){
var inputValue = $(this).val();
var result = inputValue.replace(/[^a-z0-9]/gi,'');
$("#output2").html(result + " - OR - " + $(this).val());
$(this).val(result);
});
})