Hi there gib65,
here is one possible solution - (though, it does not work in IE11) ...
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1">
<title>untitled document</title>
<link rel="stylesheet" href="screen.css" media="screen">
</head>
<body>
<form action="http://www.example.com">
<input id="number" type="number" min="0" step="any" name="number" required>
<input type="submit">
</form>
<script>
(function() {
'use strict';
var temp;
document.getElementById('number').addEventListener('input',
function() {
if( this.validity.valid ) {
temp = this.value;
}
else {
this.value = temp;
}
},false);
}());
</script>
</body>
</html>
coothead
~ the original bald headed old fart ~
Bookmarks