Thursday 15 January 2015

jquery - JavaScript if else statements to display html label -


I have a log form and I am trying to display the error message if the log is incorrect.

If valid (email and password match) then set valid user valid.

If a valid user is equal, then redirect the home page

or redirect them back to log in and display one of 3 messages. ...

Message:

'Login failed', if password is wrong then password is incorrect

If email is wrong Then the email is incorrect

is it possible

Is it possible to do all this to have a loop? I can not understand it ....

Try doing anything like this:

  if (legitimate user == incorrect) {$ ("message") . (); } And if (..........) {$ ("passwordmessage"). Show (); }  

I also want to display a message on the page and I am still using it:

  document.getElementById ('message'). Style.display  

This is my code:

So, if I make a statement to do this and how do I correct the html page element using javascript Can I display from Jquery?

Please ask if you need more code or need explanation.

Ps These are my user details

  var USERS = {users: []}; Function user (type, email, password) {this.type = type; This.email = email; This.password = password; } Var A = New User ("Representative", "a@a.com", "a"); USERS.users.push (A); Var B = New User ("Representative", "B @ B. Com", "B"); USERS.users.push (b); Var C = New User ("Customer", "c@c.com", "c"); USERS.users.push (c); Var D = New User ("Manufacturer", "d@d.com", "d"); USERS.users.push (D); Module.exports = USERS;  

In that case you have to have 3 terms. You will check the email availability and password matches if any fails, you can display the message. I could not test your code but it would be a logic and I believe the user. Users [x] .Email is the list of emails from your database. If so, sorry to say that this is a bad practice.

  validousor = wrong; Email available = False; PasswordIncorrect = false; (For var x in USERS.users) (if the email is available and email log === USERS.users [x] .email) {emailAvailable = true;} // Check whether email is available or not. If (Email is Available & amp; Password & Logic === USERS.users [x] .password) {passwordIncorrect = true; break!} // Check that the password for that email is correct or not // // For the end if (! Email is available) {console.log ("email is incorrect");} and if (email is available and password! Wrong) console.log ("password is incorrect");} other { Valid user = true; Console.log ("Valid using Ta ");} if (legitimate user) {// redirect}  

No comments:

Post a Comment