cover-img

JavaScript Popup Boxes

29 November, 2023

18

18

0

Contributors

JavaScript popup boxes are simple dialog boxes that appear on a web page. There are three main types of popup boxes in JavaScript: alert, confirm, and prompt.

  1. Alert Box
  • An alert box is used to display a message to the user.
  • It only has one button, usually labeled "OK."
alert("this is an alert message!");
  1. Confirm Box
  • A confirm box is used to ask the user for confirmation (yes or no).
  • It has two buttons, typically labeled "OK" and "Cancel" like yes or no
let result = confirm("u sure u wanna delete this");
if (result === true) {
//user clicked OK
// perform the delete operation
} else {
// user clicked Cancel
// do nothing or leave it
}
  1. Prompt Box
  • A prompt box is used to get input from the user.
  • It has an input field for the user to enter data.
let age = prompt ('enter your age ')




javascript

programming

js

developer

languages

intermediate

18

18

0

javascript

programming

js

developer

languages

intermediate

Arnob
i build web apps

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

© Copyright 2025. Showcase Creators Inc. All rights reserved.