Are you sure plugin, cannot make this work in MVC app
New mvc app in VS2015. I had implemented the windows beforeunload, which sends the alert box in all situations, clean/dirty form,
- <script language="JavaScript"> window.onbeforeunload = confirmExit; function confirmExit() { return message to display in dialog box; }</script>
but CANNOT get this jquery add-in to work, at all. why isnt it working?
- <script type="text/javascript">
- $(function () {
-
-
- $('form').areYouSure();
at the top of the mvc edit.cshtml document:
- <head>
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
-
- <!-- CSS References Here -->
- </head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <!-- Bootstrap CSS and bootstrap datepicker CSS used for styling the demo pages-->
- <link rel="stylesheet" href="~/Content/bootstrap-datepicker.css">
- <link rel="stylesheet" href="~/Content/bootstrap.css">
-
- <script src="~/Scripts/jquery-1.10.2.js"></script>
- <script src="~/Scripts/bootstrap-datepicker.js"></script>
- <script src="~/Scripts/are-you-sure.js"></script>
- <script src="~/Scripts/ays-beforeunload-shim.js"></script>
I manually downloaded and did a add/new item/ new javascript file, copied the contents from this projects github page into the manually named .js files in the /Scripts/ folder. Project already had the jquery-1-10-2.js in there
tried but cannot make this work. when loading the form, in IE, f12 says:
Object doesn't support property or method 'areYouSure'
have been trying for 2 days+, have tried variations on naming the form and div; went back on a new project and did it all from scratch. jquery itself works, the datepickers work. this is the only thing to generate the error on the F12 tool