Prevent Onclick Anchor Function From Calling Again on Enter Key From Php

SweetAlert2

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

Cipher dependencies

Download CDN

Normal alert

          alarm('Oops! Something went incorrect!')

SugarinessAlert2

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

Pretty cool huh? SweetAlert2 automatically centers itself on the folio and looks great no matter if you're using a desktop figurer, mobile or tablet. It'south fifty-fifty highly customizeable, as y'all tin see below!

More examples

  • swal('Whatever fool can apply a computer')
  • A title with a text under

    swal(            'The Net?',            'That affair is however around?',            'question'            )
  • swal(            'Practiced job!',            'You lot clicked the button!',            'success'            )
  • Custom HTML description and buttons with ARIA labels

    swal({   title:            '<i>HTML</i> <u>example</u>',   type:            'info',   html:            'You can use <b>assuming text</b>, '            +            '<a href="//github.com">links</a> '            +            'and other HTML tags',   showCloseButton:            truthful,   showCancelButton:            true,   focusConfirm:            false            confirmButtonText:            '<i form="fa fa-thumbs-up"></i> Great!',   confirmButtonAriaLabel:            'Thumbs up, cracking!',   cancelButtonText:            '<i form="fa fa-thumbs-down"></i>',   cancelButtonAriaLabel:            'Thumbs down', })
  • swal({   title:            'jQuery HTML instance',   html: $('<div>')     .addClass('some-class')     .text('jQuery is everywhere.'),   animation:            simulated,   customClass:            'animated tada'            })
  • A alert message, with a role attached to the "Confirm"-push button...

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

    swal({   championship:            'Are you certain?',   text:            "Yous won't be able to revert this!",   blazon:            'warning',   showCancelButton:            truthful,   confirmButtonColor:            '#3085d6',   cancelButtonColor:            '#d33',   confirmButtonText:            'Yes, delete it!',   cancelButtonText:            'No, abolish!',   confirmButtonClass:            'btn btn-success',   cancelButtonClass:            'btn btn-danger',   buttonsStyling:            false            }).so(              part                        () {   swal(            'Deleted!',            'Your file has been deleted.',            'success'            ) },                          office                        (dismiss) {                  if            (dismiss ===            'cancel') {     swal(            'Cancelled',            'Your imaginary file is safe :)',            'error'            )   } })
  • A bulletin with a custom image and CSS blitheness disabled

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

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

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

    swal.setDefaults({   input:            'text',   confirmButtonText:            'Adjacent &rarr;',   showCancelButton:            truthful,   blitheness:            false,   progressSteps: ['1',            '2',            '3'] })            var            steps = [   {     title:            'Question 1',     text:            'Chaining swal2 modals is like shooting fish in a barrel'            },            'Question two',            'Question 3'            ]  swal.queue(steps).then(              function                        (result) {   swal.resetDefaults()   swal({     title:            'All done!',     html:            'Your answers: <pre>'            +         JSON.stringify(effect) +            '</pre>',     confirmButtonText:            'Lovely!'            }) },                          function                        () {   swal.resetDefaults() })
  • swal.queue([{   title:            'Your public IP',   confirmButtonText:            'Testify my public IP',   text:            'Your public IP will exist received '            +            'via AJAX request',   showLoaderOnConfirm:            truthful,   preConfirm:                          function                        () {            render new            Hope(              function                        (resolve) {       $.get('https://api.ipify.org?format=json')         .done(              office                        (information) {           swal.insertQueueStep(information.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.1/core.js"></script>

Or

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

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

swal({   title:          'Fault!',   text:          'Practice you want to continue',   type:          'error',   confirmButtonText:          'Cool'          })

Treatment Dismissals

When an alert 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 close push button. showCloseButton
'esc' The user clicked the Esc key. allowEscapeKey
'timer' The timer ran out, and the alert closed automatically. timer

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

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

Modal Types

Input Types

Collaborators

Donations

Has SweetAlert2 helped you create an amazing awarding?
Y'all tin can show your support by making a donation in one of two ways:

Contribute

Feel gratis to fork SweetAlert2 on GitHub if yous have whatever features that yous want to add together!

simpsonsormse.blogspot.com

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

0 Response to "Prevent Onclick Anchor Function From Calling Again on Enter Key From Php"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel