1

I'm novice with jQuery dialog and I'm looking for a way to replace to ugly confirm javascript function by a jQuery dialog. If possible I would like a solution as easy as possible to set in place.

Example:

if (confirm("Are you sure?")) {
      // user click Yes
}

To be replaced by a simple jQuery dialog solution. If possible an 'inline' solution like:

if jQconfirm("Are you sure") { ... }

I don't know if some solutions already exist?

Thanks.

Bronzato
  • 9,438
  • 29
  • 120
  • 212
  • It's already baked into the jQuery dialog codebase - http://jqueryui.com/demos/dialog/#modal-confirmation - click on the _View Source_ on that page for the demo code, after closing the dialog :-) – andyb Mar 07 '12 at 14:01
  • Here is a demo of something that does form confirmation: http://www.jensbits.com/demos/forms/ Link to a tut is on the page. – jk. Mar 07 '12 at 18:29

2 Answers2

0

It is complicated to have such an inline solution since the confirm() halts the execution of the script, however you may modify you script a bit and use such a construct:

$.confirm("message", "title", 
         function() { /* Ok action here*/
});

Check this site for the solution.

mikewasmike
  • 348
  • 3
  • 9
0

try this http://jqueryui.com/demos/dialog/#modal-confirmation

its the JqueryUI box, and works well in a model form

Qpirate
  • 2,078
  • 1
  • 29
  • 41