SweetAlert input validation

I want the alert to not disappear when the user is trying to submit an empty form,instead it should show some error in the same alert.I tried doing swal.showInputError(“some error”) but it gives an error that it is not valid function.I tried looking at the documentation but cannot find any…

Here is my code-

     title:"Enter a Username",
     content: {
                element: "input",
                attributes: {
                    placeholder: "Type your username",
                    type: "text"

    className: "mySwal"
            //get the username





You can use this function:

inputValidator: (value) => {
    return !value && 'You need to write something!'

This will validates if the user is writing a value.

Source: stackoverflow