Reset button not working on loading JavaScript

when I remove javascript my reset button works fine but when I load JavaScript its stops working.I have also tried making rest button using jQuery function. I have also tried using input type="reset" value="Reset" but it is also not working. I have tried every thing that I know now I do not know what to do.

Please help

$(document).ready(function c () {

$(document).ready(function c1() {

//reset funtion using jquery
/*$(document).ready(function re(){
    $("#r").reset(); //reset funtion using jquery
  font-size: x-large;
  color: blue;
  color: white;
<script src=""></script>
<div align="right"><input type="submit" id="f" name="night mode" value="night mode" onclick="c()" onclick="c1()"></div>
<h2>contact form</h2>
<form action="mailto:[email protected]" method="post" enctype="text/plain">
  <label  for="company">company's name<br>
    <input type="text" id="company" name="company" autocomplete="companyname" placeholder="name" >
  <label for="contact_person">contact person<br>
    <input type="text" id="contact_person" name="contact person" autocomplete="contact person" placeholder="name">
  <label for="email">email <br>
    <input type="email" id="email" autocomplete="email" name="email" placeholder="[email protected]"> <br>
  <label >Subject</label>
  <textarea  name="subject" placeholder="Write something.."></textarea><br>
  <button type="submit" value="Submit">Submit</button> reset button 
    I have also tried using input type="reset" value="Reset"
                but it is also not working 
  <button type="reset"  onclick="re()" id="r">Reset</button>

Answers 1

  • Your problem is that you are writing your $(document).ready() wrong. You do not declare a callable function as a parameter name to ready(). It should look like this:

    $(document).ready(function() {
        function myFunc(event) {
            console.log("Function MyFunc() called");

    Next you should only have one $(document).ready(). JavaScript does support multiple ready() declarations, but this just clutters up your code.

    $( document ).ready()

Related Articles