After passing values in a form in php, jquery clears a value problem form in the form.
Php file
Now I have written a jquery code to clear the content in the name after each submission:
$(function() { $(':input','#recordform') .not(':button, :submit, :reset, :hidden') .val('') })
How can I use it? no one can add it to clear the name after submission
Help!
Reply to discussion (solution)
I don't know how your js function checkpost is written.
If checkpost only returns a true value, a new document is generated after the form is submitted. There is no such thing as modifying the original form element (or not)
The same is true for submit execution in checkpost.
If the checkpost is submitted through ajax, the required action should be written in the callback function of $. post.
Function checkpost () {if (recordform. bumen. value = "") {alert ("Select a department! "); Recordform. bumen. focus (); return false;} if (recordform. keduimokuai. value =" ") {alert (" Select team/module! "); Recordform. keduimokuai. focus (); return false;} if (recordform. keti. value =" ") {alert (" select a subject! "); Recordform. keti. focus (); return false ;}}
This is the checkpost method.
Function checkpost () {if (recordform. bumen. value = "") {alert ("Select a department! "); Recordform. bumen. focus (); return false;} if (recordform. keduimokuai. value =" ") {alert (" Select team/module! "); Recordform. keduimokuai. focus (); return false;} if (recordform. keti. value =" ") {alert (" select a subject! "); Recordform. keti. focus (); return false ;}}
This is checkpost
Your form is submitted normally. after the document is submitted, you need to click the back button of the browser to return to the form before submission.
Therefore, there is no possibility of modification.
So how can I modify (or re-write) to achieve the expected results?
Use ajax requests