You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/v2.1/javascript-dev-guide/widgets/widget_confirm.md
+59Lines changed: 59 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -121,6 +121,65 @@ The confirmation widget implements the following events:
121
121
122
122
The keyboard navigation for the alert windows is similar to the [navigation of the modal widget].
123
123
124
+
## Code Sample
125
+
126
+
### Code sample of standalone initialization
127
+
128
+
```html
129
+
<divclass="confirmation-modal-content">
130
+
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
131
+
</div>
132
+
133
+
<script>
134
+
require([
135
+
'jquery',
136
+
'Magento_Ui/js/modal/confirm'
137
+
], function ($, confirmation) {
138
+
'use strict';
139
+
140
+
confirmation({
141
+
title:$.mage.__('Confirmation Title'),
142
+
content:$('.confirmation-modal-content'),
143
+
actions: {
144
+
confirm:function(){}, //callback on 'Ok' button click
145
+
cancel:function(){}, //callback on 'Cancel' button click
146
+
always:function(){}
147
+
}
148
+
});
149
+
});
150
+
</script>
151
+
```
152
+
153
+
### Code sample of initialization on an element
154
+
155
+
```html
156
+
<divclass="confirmation-modal-content">
157
+
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
158
+
</div>
159
+
160
+
<script>
161
+
require([
162
+
'jquery',
163
+
'Magento_Ui/js/modal/confirm'
164
+
], function ($) {
165
+
'use strict';
166
+
167
+
$('.confirmation-modal-content').confirm({
168
+
title:'Confirmation Title',
169
+
actions: {
170
+
confirm:function(){}, //callback on 'Ok' button click
171
+
cancel:function(){}, //callback on 'Cancel' button click
0 commit comments