0

I've two forms on same page and I've following code:

Working for education form:

$(".add-education").on('click', function (e) {
    $('.education-edit').slideDown();
    $('.education-view').slideUp();
    $("#educ_form").reset();
    e.preventDefault();
});

Working for experience form:

$(".add-experience").on('click', function (e) {
    $('.experience-edit').slideUp();
    $('.experience-view').slideDown();
    $("#exp_form").reset();
});

Here is fiddle

What I'm missing..? Please help.

Govind Samrow
  • 9,981
  • 13
  • 53
  • 90

1 Answers1

1

Change this line:

$("#educ_form").reset();

into:

$("#educ_form")[0].reset();

Why?

.reset() isn't a jQuery function, and should be executed on the element, rather than the jQuery object. By going to the [0] (first array value). You access the getElementById() version.

roberrrt-s
  • 7,914
  • 2
  • 46
  • 57