< link href="/path/to/jquery.alerts.css" rel="stylesheet" type="text/css" media="screen" />
* This source code was highlighted with Source Code Highlighter .
- <script type = "text / javascript" >
- $ ( document ) .ready ( function () {
- $ ( "#alert_button" ) .click ( function () {
- jAlert ( 'This is a custom alert box' , 'Alert Dialog' );
- });
- $ ( "#confirm_button" ) .click ( function () {
- jConfirm ( 'Can you confirm this?' , 'Confirmation Dialog' , function (r) {
- jAlert ( 'Confirmed:' + r, 'Confirmation Results' );
- });
- });
- $ ( "#prompt_button" ) .click ( function () {
- jPrompt ( 'Type something:' , 'Prefilled value' , 'Prompt Dialog' , function (r) {
- if (r) alert ( 'You entered' + r);
- });
- });
- $ ( "#alert_button_with_html" ) .click ( function () {
- jAlert ( 'You can use HTML, such as <strong> bold </ strong>, <em> italics </ em>, and <u> underline </ u>!' );
- });
- $ ( ".alert_style_example" ) .click ( function () {
- $ .alerts.dialogClass = $ ( this ) .attr ( 'id' ); // set custom style class
- jAlert ( 'This is the custom class called & ldquo; style_1 & rdquo;' , 'Custom Styles' , function () {
- $ .alerts.dialogClass = null ; // reset to default
- });
- });
- });
- </ script>
Source: https://habr.com/ru/post/48318/
All Articles