Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

269
Views
event.preventDefault() isn't working on the form submit

I am trying to submit the form but the page just get refresh after I hit the submit button and the event.preventDefault() doesn't seems to work.

class UI {
  constructor() {
    this.budgetForm = document.getElementById("budget-form");
  }

  //submit budget method
  budgetSubmitForm() {
    console.log('hello from es6');
  }
}

function eventListenters() {
  const budgetForm = document.getElementById("budget-form");
  const expenseForm = document.getElementById("expense-form");
  const expenseList = document.getElementById('expense-list');

  // New instance of UI class 
  const ui = new UI();
  // budgetForm submit 
  budgetForm.addEventListener('submit', function(event) {
    event.preventDefault()
    ui.budgetSubmitForm()
  });

  // expense form submit 
  expenseForm.addEventListener('submit', function(event) {
    event.preventDefault();
  });

// expense list click 
  expenseList.addEventListener('click', function() {
  });
}

document.addEventListener('DOMcontentLoaded', function() {
  eventListenters();
})

I will really appreciate someone helping me!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!