Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

swal con input

Swal.fire({
  title: 'Submit your Github username',
  input: 'text',
  inputAttributes: {
    autocapitalize: 'off'
  },
  showCancelButton: true,
  confirmButtonText: 'Look up',
  showLoaderOnConfirm: true,
  preConfirm: (login) => {
    return fetch(`//api.github.com/users/${login}`)
      .then(response => {
        if (!response.ok) {
          throw new Error(response.statusText)
        }
        return response.json()
      })
      .catch(error => {
        Swal.showValidationMessage(
          `Request failed: ${error}`
        )
      })
  },
  allowOutsideClick: () => !Swal.isLoading()
}).then((result) => {
  if (result.isConfirmed) {
    Swal.fire({
      title: `${result.value.login}'s avatar`,
      imageUrl: result.value.avatar_url
    })
  }
})
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript autoscroll 
Javascript :: how to reverse number in javascript 
Javascript :: joi or null 
Javascript :: How to get all input fields inside div with JavaScript 
Javascript :: MongooseServerSelectionError: connect ECONNREFUSED ::1:27017 
Javascript :: sh: 1: react-scripts: not found 
Javascript :: firebase update users 
Javascript :: angular 9 dockerfile 
Javascript :: javascript if has jquery loaded 
Javascript :: invert binary tree javascript 
Javascript :: how to change the choose file button text in react 
Javascript :: javascript change input value 
Javascript :: react js create element 
Javascript :: gulp run sequence 
Javascript :: getboundingclientrect() javascript 
Javascript :: Putting password in a zip file using node.js 
Javascript :: Both npm and yarn have created lockfiles for this application, 
Javascript :: redirect users to anmother page in javascript 
Javascript :: how to make a vowel counter in javascript 
Javascript :: javascript array function 
Javascript :: react bind function to component 
Javascript :: js is array 
Javascript :: javascript convert character to ascii 
Javascript :: javascript get typeof array 
Javascript :: javascript remove final newline from string 
Javascript :: npm http status codes 
Javascript :: reverse a word javascript 
Javascript :: react not getting img by src 
Javascript :: How to remove title in material-table 
Javascript :: check if a column is unique sql 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =