con readonly si impedisce l'immissione di qualsiasi testo, anche dei numeri
per consentire le solo cifre puoi controllare un evento come keydown applicato all'input,
ad esempio in jQuery
Ciaocodice:var editingKeys = { '8' : 'backspace', '46' : 'canc', '37' : 'leftarrow', '39' : 'rightarrow' }; $('#iddeltuoinput').bind('keydown', function(e) { var key = e.keyCode; var keynum = (key > 47) && (key < 58); var keypad = (key > 95) && (key < 106); // tastiera numerica if (!keynum && !keypad) { return (key in editingKeys); } });

Rispondi quotando