1

I am using this: Alert for unsaved changes in form to alert for unsaved changes.

My issue is that I have multiple forms on my page:
- SearchForm
- RecordForm

I only want the alert to trigger for the RecordForm and not the SearchForm.

I can't seem to figure it out.

Community
  • 1
  • 1

1 Answers1

1

You only have to do is set an id to RecordForm container, and then change the selector to trigger the event:

// In this case 'record-form' is the id
$("#record-form :input").change(function(){
    unsaved = true;
});
lmgonzalves
  • 6,518
  • 3
  • 22
  • 41