i'm trying to use an if statement with Alertify but it seems to not work, am i doing something wrong?
var Question = alertify.prompt("what is your name?","lenovo")
if (Question === "lenovo"){
function(evt, value)
{ alertify.success('You entered: ' + value) });
}
Your prompt declaration is not the correct way, what you need to do instead is the following :
alertify.prompt("what is your name?", "lenovo",
function(evt, value) {
if (value === "lenovo") {
alertify.success('You entered: ' + value);
}
},
function() {
alertify.error('Cancel')
}
);
Note that you do not necessarely need the second function if you do not wish to handle the user clicking the Cancel button.