codedance / jquery.AreYouSure

A light-weight jQuery "dirty forms" Plugin - it monitors html forms and alerts users to unsaved changes if they attempt to close the browser or navigate away from the page. (Are you sure?)
508 stars 145 forks source link

Allow multiple confirmation messages #106

Open jsmartt opened 8 years ago

jsmartt commented 8 years ago

This PR adds the ability to set the message on a per-form basis, for the case that you have multiple forms you want checked. For example:

$('form.class1').areYouSure( {'message': 'You have unsaved changes to form 1!'} )
$('form.class2').areYouSure( {'message': 'You have unsaved changes to form 2!'} )

It's a pretty simple change, and @codedance, please review the return statement; I'm no javascript expert, so there may be some error handling that needs to be done. Also, I'm not sure that it will ever return settings.message...