Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. í class formController{
  2.  
  3. constructor(view){
  4.  
  5.  
  6. this.view = view;
  7. this.init()
  8. }
  9.  
  10. init(){
  11. this.form = this.view.getElementById('form')
  12. this.company= this.view.getElementById('company')
  13. this.student = this.view.getElementById('student')
  14. this.teacher = this.view.getElementById('teacher')
  15. this.allTravels = [];
  16. this.loadAddEvent()
  17. }
  18.  
  19.  
  20. loadAddEvent(){
  21. this.form.addEventListener('submit', this.addData);
  22.  
  23. }
  24.  
  25.  
  26. addData(e){
  27. e.preventDefault();
  28. const travel = {
  29. teacher : teacher.value,
  30. student: student.value,
  31. company: company.value,
  32. }
  33.  
  34. this.allTravels.push(travel);
  35. console.log(this.allTravels)
  36.  
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement