Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var div = document.getElementById('id-div');
- function validarNum(num) {
- if(!isNaN(num)){
- div.innerHTML += 'O valor inserido é um numero.\n'; //estamos a dizer que o conteudo HTML dessa div é igual ao atual mais o que queremos adicionar, e o \n é um line break
- return true;
- }
- else{
- div.innerHTML += 'O valor inserido não é um numero.\n';
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement