Can anybody advise me on how to control the characters when pasting?
I have the following Javascript for example that limits characters to numbers only, which works good;
function accept_alphanumeric_only(e, t) {
var regexp = new RegExp(/^[a-zA-Z0-9_.,]*$/);
if (window.event) {keynum = e.keyCode;}
else if (e.which) {keynum = e.which;}
var result = regexp.test(String.fromCharCode(keynum));
return result;}
class=“length”><input type=“text” maxlength=“8” value="<?php echo isset($_POST['lng']) ? $_POST['lng'] : '';?>" name=“lng” onkeypress=“return accept_numeric_only(event, this);” onPaste=“return accept_numeric_only(event, this);” style="width: 100%; height: 3.9mm; "
But I want onPaste to work the same, but the above code does not work.
Im not sure on how to wrap the coding, so please advise if the above is not correct.