d1dialog v1.2.12
DEPRECATED - d1dialog
This is no longer maintained.
Please consider using d1-web instead.
Add-on for d1.
Replacement of standard Javascript dialogs: alert
, confirm
, prompt
.
Demo & Docs
Install
npm install d1dialog
Usage
On page load call:
d1dialog.init(options);
In your markup:
- Add
alert
class to a link for simple alert with one button. - Add
dialog
class to a link or form button for dialog with two buttons. - Add
data-caption
ortitle
attribute to set text of dialog. - Add
data-prompt
attribute to specify URL argument for editing. - Add
data-ok
anddata-cancel
attributes to set custom button captions. - Add
data-reverse
attribute to reverse buttons order. - Add
data-src
attribute to specify selector of the input from which to take value fordata-prompt
.
If that value is not empty then prompt is not shown.
Examples
Simple alert link
<a href="#ok" class="alert" title="Hi!">Show alert</a>
Simple link with confirmation
<a href="?action" class="dialog" title="Continue?">Confirm action</a>
Simple button with confirmation
<input type="submit" value="Submit" class="dialog" title="Confirm?">
Simple link with value prompt
<a href="?action=default" class="dialog" data-prompt="action" data-caption="Action:">Action prompt</a>
Options
argConfirm
Argument appended to URL when user confirms action.
Default: "confirm"
ccDialog
CSS class (classes) of dialog window element.
Default: "dlg pad c"
hashCancel
Hash of "close" and "cancel" links.
Default: "#cancel"
hashOk
Hash of "ok" link.
Default: "#ok"
idPrefix
Prefix of the id
of dialog window element.
Default: "dlg"
Browser Support
- IE 10+
- Latest Stable: Chrome, Firefox, Opera, Safari
License
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago