
How to create an input box?

A prompt box is often used if you want the user to input a value before entering a page.
When a prompt box pops up, the user will have to click either "OK" or "Cancel" to proceed after entering an input value.
If the user clicks "OK" the box returns the input value. If the user clicks "Cancel" the box returns null.
<script type="text/javascript">
var name = prompt("What is your name", "Type you name here");
document.write("Hi " + name + "\nHope you are enjoying JavaScript!");
</script>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.