dsonesuk Posted June 5, 2014 Share Posted June 5, 2014 I've tried this code with form with just submt button, and it works fine. Are you using correct version of jquery for on(). Either that or you have conflict somewhere. Link to comment Share on other sites More sharing options...
Ingolme Posted June 5, 2014 Share Posted June 5, 2014 You should correct your HTML code, fix any mistakes that the W3C validator shows. Link to comment Share on other sites More sharing options...
funbinod Posted June 5, 2014 Author Share Posted June 5, 2014 Are you using correct version of jquery for on(). Either that or you have conflict somewhere. i'm using jquery-2.1.0.js version. and so far the conflict somewhere concerns will u please check my script? i'll post my whole script here. You should correct your HTML code, fix any mistakes that the W3C validator shows. i checked the page there and found some errors. i fixed all except CSSs. but the problem continues... Link to comment Share on other sites More sharing options...
dsonesuk Posted June 5, 2014 Share Posted June 5, 2014 Like i said i did test with minimum form test example <!DOCTYPE html><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" id="viewport" content="target-densitydpi=high-dpi,initial-scale=1.0,user-scalable=no" /> <title>Document Title</title> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> <script> $(function() { 'use strict'; function confirmDialog(title, message, success) { var confirmdialog = $('<div></div>').appendTo('body').html('<div><h4>' + message + '</h4></div>').dialog({ modal: true, title: title, zIndex: 10000, autoOpen: false, width: 'auto', resizable: false, buttons: { Yes: function() { success(); console.log("Yes"); $(this).dialog("close"); }, No: function() { $(this).dialog("close"); console.log("No"); } }, close: function() { $(this).remove(); } }); return confirmdialog.dialog("open"); } $('form').on('submit', function(e) { e.preventDefault(); var form = this; confirmDialog('Confirm', 'Are you sure?', function() { form.submit(); }); }); }); </script> <style type="text/css"> </style> </head> <body> <div>TODO write content</div> <form action="#" method="post"> <input type="submit" value="here goes"> </form> </body></html> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now