Hello all -
I am taking a javascript class and have already finished the requirements of this particular assignment. However, now I am attempting to learn more by going beyond that.
I am trying to replace the standard js prompt() with a JQuery plugin called JQuery Alert Dialogs.
http://abeautifulsite.net/blog/2008/...alert-dialogs/
It looks really good and simple to implement but I think my inexperience is hindering me here. I have added all necessary dependencies; however, I am getting weird results:
Ex.
If I have a simple prompt for a username, I have this in js:
Code:
var username = prompt("Enter Username:");
var password = prompt("Enter password:");
var valid = validateLogon(username,password);
if (valid==1) {
alert("Valid Login. Click OK to continue");
document.getElementById("welcome").innerHTML = "Welcome, " + username + "!";
chooseItem();
} else {
alert("Incorrect Username and/or Password\nPlease try again");
logon();
}
}
If I implement the JQuery Dialogs, using the jPrompt() function (as listed on the site link I gave). Basically what happens is the prompt pops up, but there is an immediate regular js alert stating the Incorrect Username and/or password (from my code).
It is almost as if the js code keeps executing in succession without passing the data (as I never have time to enter it).
I know there are other parameters i.e.
jPrompt(message, [value, title, callback])
And I do change my code to implement those; however, I am pretty sure my problem is the callback. I do not know how to use that. The plugin site says:
"These methods do not return the same values as confirm() and prompt(). You must access the resulting values using a callback function. (See the demo for more details.)"
However, I do not understand the demo - it is not very clear.
Can someone help me with this info on how to use the jPrompt() method instead of prompt()?
Thanks!