Clear the form field after successful submission of php form

后端 未结 12 1745
春和景丽
春和景丽 2020-12-16 06:10

I am making a simple Form the problem i am facing is when i submit the form values still remains in the field. and I want to clear it after SUCCESSFUL submission. Please hel

12条回答
  •  醉酒成梦
    2020-12-16 07:02

    Put the onClick function in the button submit:

    
    
    
    

    In the , define the function clearform(), and set the textbox value to "":

    function clearform()
    {
        document.getElementById("firstname").value=""; //don't forget to set the textbox id
        document.getElementById("lastname").value="";
    }
    

    This way the textbox will be cleared when you click the submit button.

提交回复
热议问题