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

186
Views
undefined function onclick event

I'm trying to create a website that would get the user input, selected options and email those inputted information to the user's email. My problem here is the onClick event doesn't work properly, it does nothing and shows that the function is not defined.

        Name:<br><input type="text" id="name" required/> <br/>

                <label><br>Example</label> 
                <br>
                    <select name="choice">
                    <option value="" selected>--SELECT--</option>
                    <option value="choice1">choice1</option>
                    <option value="choice2">choice2</option>
                    
                   </select><br>
   
                <button type='submit' onclick='myFunction()'>SUBMIT</button>
        

The function that would supposedly get the data from user input upon clicking submit.

function myFunction(){

  var name = $("#name");
  var email = $("#email");
  var schedule = $("#schedule");
  var time = $("#time"); 


  if(isNotEmpty(name) && isNotEmpty(email) && isNotEmpty(time) && isNotEmpty(schedule)) {
     $.ajax({
        url: 'send.php',
        method: 'POST',
        dataType: 'json',
        data:{
           name: name.val(),
           email: email.val(),
           schedule: schedule.val(),
           time: time.val() 
        }, success: function(response){
           $("#status")[0].reset();
           $('.status').text("Kindly check your email for status of Delivery. Thank you!");
        }
     });
  }
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Add jquery file to header. I think it's after the jquery code.

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!