Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  var div = document.getElementById('id-div');
  2.  
  3.     function validarNum(num) {
  4.         if(!isNaN(num)){
  5.             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
  6.             return true;
  7.         }
  8.         else{
  9.             div.innerHTML += 'O valor inserido não é um numero.\n';
  10.             return false;
  11.         }
  12.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement