Advertisement
selebry

fsdf

Apr 12th, 2023
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. const loginForm = document.forms[0]
  2. // loginForm.addEventListener("submit", function(e){
  3. // e.event.preventDefault()
  4. // this.submit()
  5. // })
  6. function validate(form){
  7. // console.dir(form[0])
  8. // console.dir(form[1])
  9.  
  10. const login = document.querySelector("input[name='login']")
  11. const password = document.querySelector("input[name='password']")
  12. console.dir(login)
  13. console.dir(password)
  14. return false
  15. }
  16.  
  17. loginForm.addEventListener("submit", function(e){
  18. e.preventDefault()
  19. if(validate(this))
  20. this.submit()
  21. else
  22. alert("Форма не отправлена")
  23. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement