Can't clear the input value after form is submited

前端 未结 4 1267
臣服心动
臣服心动 2021-01-28 14:45

Ok, I\'ve tried every suggestion that I could find, but those values are still there after submitting form and fadeOut. If anyone has a suggestion...



        
4条回答
  •  难免孤独
    2021-01-28 15:41

    Use the .val() function to clear the values of text , and the html() function to clear the Also, it would be easier to manipulate in jQuery if you give each input an ID.

    For example, create a form like this:

    Then in your jQuery code:

    $("#frmMessage").ajaxForm( function()
    {
        // Do whatever else you need to do first...
        // Fade out the form's container
    
    
        $("#txtName").val('');   // Clear the value of each box.
        $("#txtEmail").val('');  
        $("#txtMessage").html('');   // Different for textareas!
    
    });
    

提交回复
热议问题