How to set command line field in js field as required field?

How to set a text field field in an invitation field as a required field?

var answer=prompt('Reason for deletion?');
+4
source share
2 answers

Since it window.promptis modal, you can use the following logic:

while(!answer){
    var answer=prompt('Reason for deletion?');
};

-jsFiddle -

+7
source
    var answer=prompt('Reason for deletion?');
    if(answer !=null)
    {
    /* Your code */
    }
    else if(!answer)
    {
    alert('Entry Required');
    return false;
    }
else
{
alert('Entry Cancelled By User');
    return false;
}

Use this and also check this

0
source

Source: https://habr.com/ru/post/1589367/


All Articles