0

I have a form which is rendered by using html string from api response, jQuery is only able to bind element which are ready when page is loaded, in order to bind on dynamic tag, it should use code like

$(document).on(EVENT_NAME, element, function(){})

However, reset is not an event, so can't bind the reset function.

I have tried to bind reset function to a click event, and trigger click by $('from').trigger('click') Doesn't work

So how can I reset value for dynamically generated form

luke
  • 1
  • 1
  • 1
    Possible duplicate of [Clear form fields with jQuery](https://stackoverflow.com/questions/6364289/clear-form-fields-with-jquery) – Carsten Løvbo Andersen May 16 '19 at 06:22
  • That answer works, but it go through all input and clear its' value. It is not a good solution in my opinion, because the form may contains different type of element, such as checkbox, dropdown, select, radio. If there is a way to reset value for form, that will be greate – luke May 16 '19 at 07:15

0 Answers0