daily pastebin goal
2%
SHARE
TWEET

Untitled

a guest Jan 24th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <meta charset="utf-8">
  2. <form>
  3.     <div>
  4.         <label for="ime">Ime: </label>
  5.         <input id="ime" type="text">
  6.     </div>
  7.     <div>
  8.         <label for="prezime">Prezime: </label>
  9.         <input id="prezime" type="text">
  10.     </div>
  11.     <div>
  12.         <input id="submit" type="submit" value="PoĊĦalji">
  13.     </div>
  14. </form>
  15. <p></p>
  16.  
  17. <script>
  18.     var form = document.querySelector('form');
  19.     var ime = document.getElementById('ime');
  20.     var prezime = document.getElementById('prezime');
  21.     var submit = document.getElementById('submit');
  22.     var para = document.querySelector('p');
  23.  
  24.     form.onsubmit = function (e) {
  25.         if (ime.value === '' || prezime.value === '') {
  26.             e.preventDefault();
  27.             para.textContent = 'Morate upisati i ime i prezime!';
  28.         }
  29.     }
  30. </script>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top