Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

alert confirm prompt javascript

  if (confirm("Press a button!")) {
    console.log("Accepted")
  } else {
    console.log("Declined")
  }
Comment

Function Alert,confirm,prompt

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Try it</button>


<script>
function myFunction() {
    var name = prompt("Please enter your name", "XYZ");

    if (name != null) {
       alert('Your name is ' + name )


    }
}
</script>

</body>
</html>
Comment

confirm prompt alert

// confirm, prompt, alert is popup

// confirm 
confirm("Are you still alive?")

// prompt
prompt("Enter your name")

// alert
alert("You are a nice person")

// confirm is used for ask ok or cancel if person says ok then ok return true if person says cancel then it will return false
// prompt is use of asking text and it will return that text
// alert is to popup a message 
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to put space in between characters javascript 
Javascript :: angular ng owl date time custom format 
Javascript :: js change h 
Javascript :: pause javascript 
Javascript :: set cors for a react node application socket error 
Javascript :: javascript date get next 15 minutes 
Javascript :: npm request 
Javascript :: javascript loop over three-dimensional array 
Javascript :: dm message collector discordjs 
Javascript :: find max value in javascript 
Javascript :: volume slider javascript 
Javascript :: react native firebase email verification 
Javascript :: nodejs return code 
Javascript :: nestjs allow origin 
Javascript :: iban validation regex for all countries 
Javascript :: javascript es6 class 
Javascript :: on reload js 
Javascript :: logical operators in js 
Javascript :: get key for value javascript 
Javascript :: read json file into array javascript 
Javascript :: Como saber se existe um atributo em um objeto 
Javascript :: readfilesync buffer 
Javascript :: express json body 
Javascript :: how to remove the desimal numbers in javascript 
Javascript :: hello world program in javascript 
Javascript :: chart.js clear data 
Javascript :: node.js error handling process 
Javascript :: Find duplicate or repeat elements in js array 
Javascript :: useref in functional component 
Javascript :: Sequelize.Op; 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =