$(document).ready(function(){
var arr = [];
$(this).bind('keypress', function(e){
var code = e.keyCode || e.which;
if(code == 13) { //Enter keycode
console.log(arr.join('',','));
console.log('Press Enter');
arr = [];
} else {
// convert each kepress to character and add to array
arr.push(String.fromCharCode(e.keyCode));
}
});
});
No comments:
Post a Comment