jQDialog plugin for jQuery
jqDialog is a small (3.6 KB minified) dialog plugin that provides smooth, persistent, non-intrusive alternatives for alert(), confirm() and prompt(). There is also a notify() dialog that pops up and goes away in X seconds.
- Support for 'Enter' and 'Escape' keyboard shortcuts added (September 21, 2011)
- An IE7 compatibility bug was fixed (April 4, 2011), thanks to Filip Vojtisek.
Example code
// notify dialog
$.jqDialog.notify("This dialog will disappear in 3 seconds", 3);
// alert dialog
$.jqDialog.alert("This is a non intrusive alert", function() { // callback function for 'OK' button
alert("This intrusive alert says you clicked OK");
});
// prompt
$.jqDialog.prompt("Please enter your name", // message
'Sam', // default value in the input
function(data) { alert("Your name is " + data); }, // callback function for 'OK' button
function() { alert("This intrusive alert says you clicked Cancel"); } // callback function for 'Cancel' button
);
// confirm dialog
$.jqDialog.confirm("Are you sure want to click either of these buttons?",
function() { alert("This intrusive alert says you clicked YES"); }, // callback function for 'YES' button
function() { alert("This intrusive alert says you clicked NO"); } // callback function for 'NO' button
);
// custom content
$.jqDialog.content('No dialog controls, just custom content<br /><input type="text" name="test" />');