JSFiddle - React, Tailwind, and code Playground

by frncsdrk

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css">

JavaScript

var postsfound = 1;
var attempts = 5;
function blogposts() {
	if(postsfound <= 1) {
		swal({
  title: "Sorry!",
  text: "We currently have no other posts to show. Please check back later!",
  type: "error",
  confirmButtonText: "OK"
});
	}
}
function clickSecure() {
	swal("Secure", "We do not require any information to be given to us. We do not use cookies, which is a data sent by you to us. This insures that all connections to our servers are secure.", "success")
}
function clickQuick() {
	swal("Quick", "We quickly find the data of websites and give them to you almost instantly. We constantly update the website so we can ensure faster and better connections.", "success")
}
function clickFree() {
	swal("Free", "We give our services for free, but you can donate with PayPal. We also have affiliate sponsorships with companies so every time you click on a popup and complete an action, we get a small commission.", "success")
}
swal({
  title: "Verify",
  text: "3 + 2 =",
  content: {
    element: "input",
    attributes: {
      style: "display:block;",
      placeholder: "Write something"
    }
  },
  showCancelButton: false,
  closeOnConfirm: false,
  animation: "slide-from-top"
},
function(inputValue){
  if (inputValue === false) return false;
  console.log('inputValue:', inputValue);
  if (inputValue === "") {
    swal.showInputError("You have not entered anything. Please try again.");
    attempts -= 1;
    return false
  }
  if(inputValue !== "5") {
  	swal.showInputError("Please try again. You have " + attempts + " attempts left.");
  	attempts -= 1;
  } else {
  	swal("Success!", "You wrote " + inputValue, "success");
  }
  if(attempts <= 0) {
  	swal({
  title: "Verification failed.",
  text: "Please wait for the page to reload. You must wait 10 seconds and the page will open.",
  timer: 10000,
  showConfirmButton: false,
});
  }
  //swal("Nice!", "You wrote: " + inputValue, "success");
});