You can styling your own popup. Or use some plugins.

http://jquerybyexample.blogspot.com/2013/01/jquery-popup-window-tutorial-plugins.html

Or you can create some element on the page, that will showing the error messages. Write some styles and make it look awesome !

<div class="error-messages" style="display:none;"></div>

After the form sending, and checking errors, write this.

$(".error-messages").text("Some error").fadeIn();

Or you can make it empty and hide it, after a seconds or after user focus.

$(".error-messages").empty().fadeOut();
Answer from m1k1o on Stack Overflow
🌐
W3Schools
w3schools.com › js › js_output.asp
JavaScript Output
Changing the innerHTML property of an HTML element is the most common way to display data in HTML.
🌐
TutorialsTeacher
tutorialsteacher.com › javascript › display-popup-message-in-javascript
JavaScript Message Boxes: alert(), confirm(), prompt()
The alert() function displays a message to the user to display some information to users. This alert box will have the OK button to close the alert box. ... The alert() function takes a paramter of any type e.g., string, number, boolean etc.
🌐
Team Treehouse
teamtreehouse.com › library › javascript-basics › display-messages-with-javascript
Display Messages with JavaScript (How To) | JavaScript Basics | Treehouse
in a period, JavaScript statements end in a ;. 3:27 · You write programs by typing multiple statements, 3:31 · just like you write a paragraph by writing multiple sentences. 3:34 ... Pressing Enter displays the message.
Published   February 18, 2020
🌐
University of Washington
washington.edu › accesscomputing › webd2 › student › unit5 › module2 › lesson1.html
Using JavaScript to Show an Alert
In PHP, variable names must start with a $, but that isn't the case in JavaScript. Take a look at the following example, which uses a variable named myText to customize the text that's displayed in the alert box. <script> function showAlert() { var myText = "This can be whatever text you like!"; alert (myText); } </script> Try modifying your showAlert() script with your own custom alert message.
🌐
W3Schools
w3schools.com › jsref › met_win_alert.asp
Window alert() Method
The alert() method displays an alert box with a message and an OK button. The alert() method is used when you want information to come through to the user.
🌐
Code Boxx
code-boxx.com › home › 6 ways to display messages in html javascript (simple examples)
6 Ways To Display Messages In HTML Javascript (Simple Examples)
July 2, 2023 - For you guys who have not heard, this is where Javascript outputs all error messages, and whatever you don’t want the users to see. Press F12 to open the developer’s console in most modern browsers. console.log() Will show a message in the developer’s console.
🌐
Stack Overflow
stackoverflow.com › questions › 70006301 › how-to-display-messages-before-executing
javascript - How to display messages before executing - Stack Overflow
You have to give the browser a chance to update the display before you start the work: show_message("starting"); setTimeout(() => { this_function_takes_forever(); show_message("done"); }, 100);
Find elsewhere
🌐
SheCodes
shecodes.io › athena › 12892-how-to-display-an-alert-message-in-javascript
[JavaScript] - How to display an alert message in | SheCodes
Learn how to use the alert() function to display pop-up messages in JavaScript with this simple example code snippet.
🌐
Stack Overflow
stackoverflow.com › questions › 48105950 › how-do-i-display-a-alert-on-a-website
javascript - How do I display a alert on a website? - Stack Overflow
<script type="text/javascript"> alert('My message goes here'); </script> If you want to change the way this looks, you will have to use an HTML modal. By using that, you can customize the HTML&CSS to look exactly like the picture you attached.
🌐
W3Schools
w3schools.com › js › js_popup.asp
JavaScript Popup Boxes
To display line breaks inside a popup box, use a back-slash followed by the character n. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com · If you want to report ...
Top answer
1 of 2
1

Use setTimeout, when you click button I stop interval and timer function because it is success, and when button isn't clicked and if x variable isn't y timer and interval continues countDown, I used setInterval for understanding how it works, also I edited code , I might this is what you want

const input = document.querySelector("input")
const button = document.querySelector("button")
const textTimer = document.querySelector("p")

let number = 10

let x = ""

textTimer.innerHTML = number


button.addEventListener("click", ()=> {
   x = input.value
   
   if(x === "y"){
    alert("success")
    clearTimeout(timer)
    clearInterval(interval)
  }
  
  console.log(x)
})

const interval = setInterval(()=> {
  number--
  textTimer.innerHTML = number

  if(number <= 0){
    clearInterval(interval)
  }
}, 1000)

const timer = setTimeout(()=> {
    if(x.length > 0){
    alert("Success")
  } else {
     alert("There is a problem")
  }
}, 10000)
<input type="text">
<button>Insert Value in x</button>

<p></p>

2 of 2
0

The solution is .setTimeout() which allows you to run the function, command ... after an estimated time.

/*

// ES6

const checkVal = () => {

  const input = document.querySelector('input').value;
  
  // Ternary Operator
  input === 'yes' ? alert('yes') : alert('no');
};

*/

function checkVal() {

  const input = document.querySelector('input').value;
  
  if(input.toLowerCase() === 'yes') {
    alert('yes')
  } else {
    alert('no')
  };
  
};


// 2000 means 2k miliseconds, if you want to set it on 10 seconds, then 10000

document.querySelector('button').addEventListener('click', () => {
  setTimeout(checkVal
    , 2000
  )}
);
<p>If you type *yes*, it will alert yes. But if you type anything else(not yes) it will show *no*.</p>
<input type='text'>
<button type='text'>Click</button>

🌐
SheCodes
shecodes.io › athena › 52159-how-to-display-a-message-box-in-javascript-using-alert
[JavaScript] - How to display a message box in JavaScript using alert()
Learn how to display a message box in a browser using the alert() method in JavaScript, and also how to use JOptionPane to display a message box in Java programs.
🌐
EDUCBA
educba.com › home › software development › software development tutorials › javascript tutorial › javascript message box
JavaScript Message Box | How Does Message Box Work in JavaScript?
April 1, 2023 - JavaScript Message Box is nothing but the alert box which is used to show message along with the Ok button. Those type of message box helps users to distract user from the current window and it forces user to read text or message from the message ...
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
O'Reilly
oreilly.com › library › view › javascript-the-definitive › 0596101996 › re476.html
Window.alert( ): display a message in a dialog box — JavaScript 1.0: - JavaScript: The Definitive Guide, 5th Edition [Book]
August 17, 2006 - 23.1. Scripting Applets23.2. Scripting ... to display in a dialog box popped up over window. The alert( ) method displays the specified message to the user in a dialog box....
Author   David Flanagan
Published   2006
Pages   1018
🌐
Noveblo
noveblo.com › プログラミング › html/css/javascript
JavaScript & CSS – how to display a message clicking the button – 4 ways | ノベブロ / NOVEBLO
July 8, 2023 - In 3 seconds, the message disappears. Button-4 clicked! The simplest way to display a message. Just use the JavaScript function alert().
🌐
Altcademy
altcademy.com › blog › how-to-display-text-in-javascript
How to display text in JavaScript
August 28, 2023 - Imagine you're learning a new language and you want to say hello to someone. The first thing you might learn is how to say "hello". Similarly, when you're learning JavaScript, one of the first things you might want to do is display some text. In JavaScript, we usually do this with a command called console.log.
🌐
GeeksforGeeks
geeksforgeeks.org › how-to-display-error-without-alert-box-using-javascript
How to display error without alert box using JavaScript ? - GeeksforGeeks
September 24, 2024 - Table of Content Using a Custom ... with React Bootstrap ? In React Bootstrap, an `Alert` is a component used to display various types of messages or notifications to users....