Hi,
I'm trying to limit the number of character a user can type in a
contenteditable=true
div;I've bound a handler on keydown event to check the size of the typed text.
The code works fine on the simulator but not on the device.
HTML :
<div class = "center" contenteditable = "true" style = "padding-top: .5vh" id = "name"></div>
JS :
$( "#name" ).bind( "keydown", function( e ) {
if( e.which !== 8 && $( this ).text().length >= 16 ) {
e.preventDefault();
return false;
}
return true;
});
Regards,