slc
slc

Reputation: 79

Clearing specific inputs after Ajax post

The plan is to clear input fields after part of form is sucessfuly posted using ajax. I cannot clear all form, rest of fields are required. This does not work:

 $.ajax({
    url : "http://mysite.lv/projects/addform",
    type: "POST",
    data : myArray,
    success: function(){ 
        document.getElementById("alias").clearForm();

Upvotes: 2

Views: 48

Answers (1)

Milind Anantwar
Milind Anantwar

Reputation: 82241

You can simply set empty val using .val('') for inputs in form. something like this:

 $('#alias input[type=textbox]').val('');

Upvotes: 1

Related Questions