Jquery clears a certain value in the form after passing values in the form in php.

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.