Oops Try Again Make Sure You Modify Your Button s Onclick by Adding a Second Name

SugarinessAlert2

A beautiful, responsive, customizable, attainable (WAI-ARIA) replacement for JavaScript's popup boxes

Nothing dependencies

Download CDN

Normal alert

          alert('Oops! Something went wrong!')

SweetAlert2

swal(          'Oops...',          'Something went incorrect!',          'fault'          )

Pretty cool huh? SweetAlert2 automatically centers itself on the page and looks neat no matter if you're using a desktop computer, mobile or tablet. It's fifty-fifty highly customizeable, as yous tin see below!

More than examples

  • swal('Whatever fool can use a reckoner')
  • A title with a text under

    swal(            'The Internet?',            'That thing is still around?',            'question'            )
  • swal(            'Good job!',            'You clicked the button!',            'success'            )
  • Custom HTML description and buttons with ARIA labels

    swal({   title:            '<i>HTML</i> <u>case</u>',   type:            'info',   html:            'You can utilize <b>bold text</b>, '            +            '<a href="//github.com">links</a> '            +            'and other HTML tags',   showCloseButton:            truthful,   showCancelButton:            true,   focusConfirm:            false            confirmButtonText:            '<i class="fa fa-thumbs-up"></i> Peachy!',   confirmButtonAriaLabel:            'Thumbs up, groovy!',   cancelButtonText:            '<i grade="fa fa-thumbs-downwardly"></i>',   cancelButtonAriaLabel:            'Thumbs down', })
  • swal({   championship:            'jQuery HTML example',   html: $('<div>')     .addClass('some-class')     .text('jQuery is everywhere.'),   blitheness:            false,   customClass:            'blithe tada'            })
  • A alarm bulletin, with a function fastened to the "Confirm"-button...

    swal({   title:            'Are you sure?',   text:            "You won't be able to revert this!",   type:            'alert',   showCancelButton:            true,   confirmButtonColor:            '#3085d6',   cancelButtonColor:            '#d33',   confirmButtonText:            'Yes, delete information technology!'            }).then(              role                        () {   swal(            'Deleted!',            'Your file has been deleted.',            'success'            ) })
  • ... and by passing a parameter, you can execute something else for "Cancel".

    swal({   championship:            'Are you sure?',   text:            "Y'all won't be able to revert this!",   blazon:            'warning',   showCancelButton:            true,   confirmButtonColor:            '#3085d6',   cancelButtonColor:            '#d33',   confirmButtonText:            'Yeah, delete it!',   cancelButtonText:            'No, cancel!',   confirmButtonClass:            'btn btn-success',   cancelButtonClass:            'btn btn-danger',   buttonsStyling:            false            }).then(              function                        () {   swal(            'Deleted!',            'Your file has been deleted.',            'success'            ) },                          function                        (dismiss) {                  if            (dismiss ===            'cancel') {     swal(            'Cancelled',            'Your imaginary file is safe :)',            'error'            )   } })
  • A bulletin with a custom prototype and CSS animation disabled

    swal({   title:            'Sweet!',   text:            'Modal with a custom image.',   imageUrl:            'https://unsplash.it/400/200',   imageWidth:            400,   imageHeight:            200,   imageAlt:            'Custom prototype',   animation:            false            })
  • A message with custom width, padding and background

    swal({   title:            'Custom width, padding, background.',   width:            600,   padding:            100,   background:            '#fff url(//bit.ly/1Nqn9HU)'            })
  • A message with auto close timer

    swal({   title:            'Motorcar shut alert!',   text:            'I will close in 5 seconds.',   timer:            5000,   onOpen:                          function                        () {     swal.showLoading()   } }).so(                          function                        () {},                             part                        (dismiss) {            if            (dismiss ===            'timer') {       console.log('I was closed by the timer')     }   } )
  • swal({   title:            'Submit e-mail to run ajax asking',   input:            'email',   showCancelButton:            true,   confirmButtonText:            'Submit',   showLoaderOnConfirm:            truthful,   preConfirm:                          office                        (email) {            return new            Promise(              function                        (resolve, reject) {            setTimeout(function() {            if            (email ===            'taken@example.com') {           reject('This email is already taken.')         } else {           resolve()         }       },            2000)     })   },   allowOutsideClick:            simulated            }).then(              function                        (email) {   swal({     type:            'success',     championship:            'Ajax request finished!',     html:            'Submitted email: '            + email   }) })
  • Chaining modals (queue) example

    swal.setDefaults({   input:            'text',   confirmButtonText:            'Next &rarr;',   showCancelButton:            true,   animation:            false,   progressSteps: ['i',            'ii',            '3'] })            var            steps = [   {     championship:            'Question 1',     text:            'Chaining swal2 modals is easy'            },            'Question ii',            'Question iii'            ]  swal.queue(steps).then(              function                        (result) {   swal.resetDefaults()   swal({     title:            'All done!',     html:            'Your answers: <pre>'            +         JSON.stringify(issue) +            '</pre>',     confirmButtonText:            'Lovely!'            }) },                          role                        () {   swal.resetDefaults() })
  • swal.queue([{   title:            'Your public IP',   confirmButtonText:            'Show my public IP',   text:            'Your public IP will be received '            +            'via AJAX asking',   showLoaderOnConfirm:            truthful,   preConfirm:                          function                        () {            return new            Hope(              function                        (resolve) {       $.get('https://api.ipify.org?format=json')         .done(              office                        (data) {           swal.insertQueueStep(data.ip)           resolve()         })     })   } }])

Usage

1. Initialize the plugin by referencing the necessary files:

<script          src="bower_components/sweetalert2/dist/sweetalert2.min.js"></script> <link          rel="stylesheet"          href="bower_components/sweetalert2/dist/sweetalert2.min.css">   <script          src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.ane/core.js"></script>

Or

            import          swal          from          'sweetalert2'                    const          swal =          crave('sweetalert2')

2. Call the sweetAlert2-function after the page has loaded

swal({   title:          'Error!',   text:          'Do you want to continue',   blazon:          'error',   confirmButtonText:          'Absurd'          })

Treatment Dismissals

When an warning is dismissed by the user, the Promise returned by swal() will reject with a string documenting the reason it was dismissed:

String Description Related configuration
'overlay' The user clicked the overlay. allowOutsideClick
'cancel' The user clicked the cancel button. showCancelButton
'close' The user clicked the shut button. showCloseButton
'esc' The user clicked the Esc cardinal. allowEscapeKey
'timer' The timer ran out, and the alarm closed automatically. timer

If rejections are non handled, it will be logged as an mistake. To avoid this, add a rejection handler to the Promise.
Alternatively, yous can use .catch(swal.noop) as a quick way to simply suppress the errors:

swal(...)   .catch(swal.noop)

Modal Types

Input Types

Collaborators

Donations

Has SweetAlert2 helped y'all create an amazing application?
You can show your support by making a donation in one of two means:

Contribute

Feel free to fork SweetAlert2 on GitHub if y'all accept whatever features that you want to add!

matthewsrosees.blogspot.com

Source: https://kepriprov.go.id/assets/plugins/sweetalert/

0 Response to "Oops Try Again Make Sure You Modify Your Button s Onclick by Adding a Second Name"

ارسال یک نظر

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel