I have a question that I want to put an input in an alert box. What thing I have to do to create this? To make it I've to put an another tag, attrib, special properities, etc... Thanks. I think could be like this:
<!DOCTYPE html>
<html>
<head>
<title>example</title>
</head>
<body>
<script type="text/javascript">
alert("<input></input>");
</script>
</body>
</html>
You can't put anything in an alert box. As the name indicates, it's an alert. You might be looking for a prompt which has an input text field, or confirm to get a true / false depending on user selection.
let foo = prompt('Type here');
let bar = confirm('Confirm or deny');
console.log(foo, bar);
You can use
var resp = window.prompt("Your question")
window.prompt is a blocking method (like alert). The program execution will halt until the user enters a value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With