jquery keypress objet d'événement keyCode pour problème de firefox?
jQuery événement keypress pour FireFox donne chiffré keyCode
propriété pour objet d'événement
après String.fromCharCode(e.keyCode)
la conversion, mais fonctionne parfaitement en Chrome.
Qui suit est le code javascript:
<!-- #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>
source d'informationauteur Mr Coder
Vous devez vous connecter pour publier un commentaire.
Vous devez utiliser
e.charCode
dans Firefox.Essayer ici:
http://jsfiddle.net/REJ4t/
PS
Si vous vous demandez pourquoi tout ce gâchis: http://www.quirksmode.org/js/keys.html
Il fonctionne aussi bien sur IE & FF.