I want to open an alert box (Javascript) with one input text, then on user click is submit to another page, its like a form with one input text, all the examples that given are modals examples, i just need an alertbox.
Once the form is completed, the button is clicked and an alert box pops up showing the form data entered.
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.
You are calling alert() with DOM element #message as parameter. To correct this you can pass . value property of #message : message to alert(message. value) .
The standard alert box in JavaScript does not provide the option to apply CSS. To style your alert box, you need to create a custom one first. The custom alert box will be created using jQuery and styles will be applied to CSS.
Assuming I've understood your question correctly, you can use the DOM prompt
method:
var result = prompt("Enter 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