jquery.AreYouSure
jquery.AreYouSure copied to clipboard
Add a custom check
Hi there!
Great plugin. Is there a way to customize the check of are you sure?
What I want :
if form is dirty
send an alert
if form isn't dirty
if custom function return true
send an alert
Thanks!
That's a good request. I'll need to think about the most elegant way of implementing this. It might be worth adding a custom function hook as you've suggested. e.g.
$('#myform').areYouSure({customCheck: function() { if (rand > 0.5) return true; }});
If we go down this path, do you have any thoughts on the option name?
As for doing this in the current version: There is an existing hook to intercept dirty state changes and in theory you could say add the ".dirty" class back on the form. It should work, but it's a bit hacky.
Cheers,
Chris
Hey Chris!
Thanks for the tips.
customCheck isn't that bad ;)