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

231
Views
Javascript form checking without innerhtml response

Hi im just starting to learn web development but I can't seem to find why my innerHTML won't appear on my page can someone help me ? I need to show these error messages if the fields are left empty but I can't seem to get it working for some reason :/

JS:

// B. email

const frmOrder = document.querySelector('#frmOrder');
const inpEmail = frmOrder.querySelector('#inpEmail');
const msgEmail = frmOrder.querySelector('.message');
// B. Dropdown
const selMeasure = frmOrder.querySelector('#selMeasure');
const msgMeasure = frmOrder.querySelector('.selMeasure .message');

//B. Checking
frmOrder.setAttribute('novalidate', 'novalidate');
frmOrder.addEventListener('sumbit', function (e) { 
    e.preventDefault();
    let numErrors = 0 ;
    
    msgEmail.innerHTML = '' ;
    msgMeasure.innerHTML = '' ;


if (inpEmail.value == '' ) {
    msgEmail.innerHTML = "please fill in ur email!";
    numErrors++;
}
if (selMeasure.value == '' ) {
    msgMeasure.innerHTML = "please fill in ur Measurement!";
    numErrors++
}
if (numErrors == 0) {
    frmOrder.sumbit();
    lblMessage.innerHTML = `Het formulier is correct ingevuld`;
   

}
});
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

There are syntax errors in your code.

Change the word sumbit to submit.

about 4 years ago · Juan Pablo Isaza Report
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!