jQuery keypress event for FireFox gives encrypted keyCode
property for event object
after String.fromCharCode(e.keyCode)
conversion but works perfect in Chrome.
Following is the javascript code:
<!-- #booter and #text are ids of html element textarea -->
<script type="text/javascript">
$(function(){
$('#booter').keypress(function(e){
var input = $(this).val() + String.fromCharCode(e.keyCode);
$('#text').focus().val(input);
return false;
});
});
</script>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…