+ 4
How to make an alert if the user inputs nothing else.
if the user doesn't input anything then how to make alert in js.
3 Réponses
0
function hello(){
var input=prompt("enter your name");
if(input===""){
alert("enter a valid name");
}
else{
document.write("hi "+input);
}
}
- 1
why js use
<input type="text" name="whatever" required>
i wont be able to submit until wrote anything into it
- 1
but to answere your question
alert("whaterver you wanna alert him to do");