8
est-il un moyen d'obtenir un travail .keypress sur un élément div comme ceci ?:.keypress sur un tag DIV?
<html>
<body>
<script type="text/javascript">
<!--
$('#idtext').keypress(function(event) {
var keyCode = event.keyCode;
$('#idtext').text(function(i, text) {
return text + String.fromCharCode(keyCode);
});
});
// -->
</script>
<div id="idtext"></div>
</body>
</html>
mmm ne fonctionne pas: http://jsbin.com/aqiza/2 – xRobot
L'exemple est beaucoup trop compliqué pour dire que c'est ma suggestion qui ne fonctionne pas. Simplifié: http://jsbin.com/aqiza/7 –
@xRobot vous avez erreur changer '$ ('# cmd span');' à '$ ('# cmd div # mytext');' voir http: // jsbin.com/aqiza/13 – jcubic