Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- function validate(evt) {
- var theEvent = evt || window.event;
- // Handle paste
- if (theEvent.type === 'paste') {
- key = event.clipboardData.getData('text/plain');
- } else {
- // Handle key press
- var key = theEvent.keyCode || theEvent.which;
- key = String.fromCharCode(key);
- }
- //var regex = /[0-9]|\./; ini hanya angka
- var regex = /[0-9]^\w{0,10}$|\./; //saya mau min. 9 max. 9
- if( !regex.test(key) ) {
- theEvent.returnValue = false;
- if(theEvent.preventDefault) theEvent.preventDefault();
- }
- }
- </script>
Add Comment
Please, Sign In to add comment