Why not cleared field on the form?

Good day!

There is such code:
$(document).ready(function() {

// Add the mask for a field with a phone number
$('.phonemasked').each(function(){
 $(this).mask('+7 (999) 999-99-99');
});
$(".user_request").submit(function() {
 if ( !this.checkValidity() )
 alert('Please complete mandatory field.');
 else {
$.ajax({
 type: "POST",
 url: "/form/mail.php",
 data: $( this ).serialize()
 }).done( function() {
 alert( "the Request has been accepted. Soon our lawyer will contact You." );
 // clear fields
$('#name').val(");
$('#phone').val(");
$('#mail').val(");
$('#city').val(");
$('#nalog').val(");
$('#okved').val(");
$('#participants').val(");
});
}
 return false;
});
});

And after sending the form fields are not cleared, although in the past the cleanup was...
March 12th 20 at 08:06
2 answers
March 12th 20 at 08:08
March 12th 20 at 08:10
Bad way to clean. You can do the reset from the forms.
it is here inserted? or in php file - wallace_Carro commented on March 12th 20 at 08:13
@wallace_Carro,
// clear fields
$(this)[0].reset();
 // $('#name').val(");
 // $('#phone').val(");
 // $('#mail').val(");
 // $('#city').val(");
 // $('#nalog').val(");
 // $('#okved').val(");
 // $('#participants').val(");
- Johnathan_Jast commented on March 12th 20 at 08:16

Find more questions by tags JavaScript