Comparing user sign up info in an array with user login inputConverting user input string to regular expressionPop up php table value to normal window combobox not working using javascriptHow to eval or parse jquery code that's pulled in as a .val() value?jquery window.click not working first timeHow to compare arrays in JavaScript?Handling client independent user logging inputHow to export JavaScript array info to csv (on client side)?keyup event not triggered for escape keyForm inputs have no cursor - jQuery UI in Chrome after htaccess loginHide/show an element based on value of var
How to speed up large double sums in a table?
How can I obtain and work with a Platonic dodecahedron?
How long does it take a postcard to get from USA to Germany?
Debian 9 server no sshd in auth.log
Installing Debian 10, upgrade to stable later?
Ab major 9th chord in Bach
Game artist computer workstation set-up – is this overkill?
How to deal with employer who keeps me at work after working hours
What are these silver "sporks" for?
TIP120 Transistor + Solenoid Failing Randomly
Do quaternary sulfur dications exist?
Huffman Code in C++
Given four points how can I find an equation for any pattern?
Explaining intravenous drug abuse to a small child
Problem with estimating a sequence with intuition
My large rocket is still flipping over
Endgame puzzle: How to avoid stalemate and win?
How to say something covers all the view up to the horizon line?
What is monoid homomorphism exactly?
Does Thanos's ship land in the middle of the battlefield in "Avengers: Endgame"?
How to preserve a rare version of a book?
Justification of physical currency in an interstellar civilization?
What are the requirements for a river delta to form?
While drilling into kitchen wall, hit a wire - any advice?
Comparing user sign up info in an array with user login input
Converting user input string to regular expressionPop up php table value to normal window combobox not working using javascriptHow to eval or parse jquery code that's pulled in as a .val() value?jquery window.click not working first timeHow to compare arrays in JavaScript?Handling client independent user logging inputHow to export JavaScript array info to csv (on client side)?keyup event not triggered for escape keyForm inputs have no cursor - jQuery UI in Chrome after htaccess loginHide/show an element based on value of var
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have two buttons: a sign up and a log in. I intend to collect the input form values from the sign up into an array (this works). I then want to compare the user input from the sign up with the user input from the login and notify the user that they are logged in. (I am yet to get started with localStorage and JSON. I want to get this done using arrays first).
I have tried using a for loop and if statements with logical operators (&&).
$(document).ready(function()
$("#userSignUp").click(function()
$("#signUpForm").show();
$("#signup").hide();
);
$("#userInfo").click(function(event)
var custName = $("#newName").val();
var custEmail = $("#newEmail").val();
var custPass = $("#newPass").val();
var custData = [];
custData.push(custName, custEmail, custPass);
$("#userSignUp").text("Thank you for signing up!");
);
$("#userLogIn").click(function()
$("#loginForm").show();
$("#login").hide();
);
$("#userData").click(function(event)
var currentName = $("#userName").val();
var currentEmail = $("#userEmail").val();
var currentPass = $("#userPass").val();
for (var i = 0; i < custData.length; i++)
if ((currentName === custData[0]) && currentEmail === custData[1] && currentPass === custData[2])
$("#userLogIn").text("You are logged in!");
else
$("#userLogIn").text("Please enter correct name, email and password!");
;
);
);
javascript jquery html css bootstrap-4
add a comment |
I have two buttons: a sign up and a log in. I intend to collect the input form values from the sign up into an array (this works). I then want to compare the user input from the sign up with the user input from the login and notify the user that they are logged in. (I am yet to get started with localStorage and JSON. I want to get this done using arrays first).
I have tried using a for loop and if statements with logical operators (&&).
$(document).ready(function()
$("#userSignUp").click(function()
$("#signUpForm").show();
$("#signup").hide();
);
$("#userInfo").click(function(event)
var custName = $("#newName").val();
var custEmail = $("#newEmail").val();
var custPass = $("#newPass").val();
var custData = [];
custData.push(custName, custEmail, custPass);
$("#userSignUp").text("Thank you for signing up!");
);
$("#userLogIn").click(function()
$("#loginForm").show();
$("#login").hide();
);
$("#userData").click(function(event)
var currentName = $("#userName").val();
var currentEmail = $("#userEmail").val();
var currentPass = $("#userPass").val();
for (var i = 0; i < custData.length; i++)
if ((currentName === custData[0]) && currentEmail === custData[1] && currentPass === custData[2])
$("#userLogIn").text("You are logged in!");
else
$("#userLogIn").text("Please enter correct name, email and password!");
;
);
);
javascript jquery html css bootstrap-4
add a comment |
I have two buttons: a sign up and a log in. I intend to collect the input form values from the sign up into an array (this works). I then want to compare the user input from the sign up with the user input from the login and notify the user that they are logged in. (I am yet to get started with localStorage and JSON. I want to get this done using arrays first).
I have tried using a for loop and if statements with logical operators (&&).
$(document).ready(function()
$("#userSignUp").click(function()
$("#signUpForm").show();
$("#signup").hide();
);
$("#userInfo").click(function(event)
var custName = $("#newName").val();
var custEmail = $("#newEmail").val();
var custPass = $("#newPass").val();
var custData = [];
custData.push(custName, custEmail, custPass);
$("#userSignUp").text("Thank you for signing up!");
);
$("#userLogIn").click(function()
$("#loginForm").show();
$("#login").hide();
);
$("#userData").click(function(event)
var currentName = $("#userName").val();
var currentEmail = $("#userEmail").val();
var currentPass = $("#userPass").val();
for (var i = 0; i < custData.length; i++)
if ((currentName === custData[0]) && currentEmail === custData[1] && currentPass === custData[2])
$("#userLogIn").text("You are logged in!");
else
$("#userLogIn").text("Please enter correct name, email and password!");
;
);
);
javascript jquery html css bootstrap-4
I have two buttons: a sign up and a log in. I intend to collect the input form values from the sign up into an array (this works). I then want to compare the user input from the sign up with the user input from the login and notify the user that they are logged in. (I am yet to get started with localStorage and JSON. I want to get this done using arrays first).
I have tried using a for loop and if statements with logical operators (&&).
$(document).ready(function()
$("#userSignUp").click(function()
$("#signUpForm").show();
$("#signup").hide();
);
$("#userInfo").click(function(event)
var custName = $("#newName").val();
var custEmail = $("#newEmail").val();
var custPass = $("#newPass").val();
var custData = [];
custData.push(custName, custEmail, custPass);
$("#userSignUp").text("Thank you for signing up!");
);
$("#userLogIn").click(function()
$("#loginForm").show();
$("#login").hide();
);
$("#userData").click(function(event)
var currentName = $("#userName").val();
var currentEmail = $("#userEmail").val();
var currentPass = $("#userPass").val();
for (var i = 0; i < custData.length; i++)
if ((currentName === custData[0]) && currentEmail === custData[1] && currentPass === custData[2])
$("#userLogIn").text("You are logged in!");
else
$("#userLogIn").text("Please enter correct name, email and password!");
;
);
);
javascript jquery html css bootstrap-4
javascript jquery html css bootstrap-4
asked Mar 23 at 4:59
AbbyAbby
12
12
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
May be you could try only IF statement without the loop.
The following thing checks if there is such item in the array and if it IS, will do smth:
if (custData.indexOf(currentName) != -1
&& custData.indexOf(currentEmail) != -1
&& custData.indexOf(currentPass) != -1)
$("#userLogIn").text("You are logged in!");
else {
$("#userLogIn").text("Please enter correct name, email and password!");
Hey Daniel, tried, doesn't work
– Abby
Mar 28 at 7:02
add a comment |
I have been learning about localStorage. I decided to use it on this task. I collected the values that the user inputs when signing up, and 'saved' them on local Storage. I then collected the value the user inputs and 'retrieved' them via local Storage. Here is the code:
$(document).ready(function()
$("#userSignUp").click(function()
$("#signUpForm").show();
$("#signup").hide();
);
$("#userInfo").click(function(event)
var custName = $("#newName").val();
var custEmail = $("#newEmail").val();
var custPass = $("#newPass").val();
localStorage.setItem("name", "Raych") +
localStorage.setItem("email", "raych@gmail.com") +
localStorage.setItem("password", "hey"); ;
$("#userSignUp").text("Thank you for signing up!");
);
$("#userLogIn").click(function()
$("#loginForm").show();
$("#login").hide();
);
$("#userData").click(function(event)
event.PreventDefault;
var currentName = $("#userName").val();
var currentEmail = $("#userEmail").val();
var currentPass = $("#userPass").val();
localStorage.getItem("name") +
localStorage.getItem("email") +
localStorage.getItem("password");
$("#userLogIn").text("You are logged in!");
);
);
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55310759%2fcomparing-user-sign-up-info-in-an-array-with-user-login-input%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
May be you could try only IF statement without the loop.
The following thing checks if there is such item in the array and if it IS, will do smth:
if (custData.indexOf(currentName) != -1
&& custData.indexOf(currentEmail) != -1
&& custData.indexOf(currentPass) != -1)
$("#userLogIn").text("You are logged in!");
else {
$("#userLogIn").text("Please enter correct name, email and password!");
Hey Daniel, tried, doesn't work
– Abby
Mar 28 at 7:02
add a comment |
May be you could try only IF statement without the loop.
The following thing checks if there is such item in the array and if it IS, will do smth:
if (custData.indexOf(currentName) != -1
&& custData.indexOf(currentEmail) != -1
&& custData.indexOf(currentPass) != -1)
$("#userLogIn").text("You are logged in!");
else {
$("#userLogIn").text("Please enter correct name, email and password!");
Hey Daniel, tried, doesn't work
– Abby
Mar 28 at 7:02
add a comment |
May be you could try only IF statement without the loop.
The following thing checks if there is such item in the array and if it IS, will do smth:
if (custData.indexOf(currentName) != -1
&& custData.indexOf(currentEmail) != -1
&& custData.indexOf(currentPass) != -1)
$("#userLogIn").text("You are logged in!");
else {
$("#userLogIn").text("Please enter correct name, email and password!");
May be you could try only IF statement without the loop.
The following thing checks if there is such item in the array and if it IS, will do smth:
if (custData.indexOf(currentName) != -1
&& custData.indexOf(currentEmail) != -1
&& custData.indexOf(currentPass) != -1)
$("#userLogIn").text("You are logged in!");
else {
$("#userLogIn").text("Please enter correct name, email and password!");
answered Mar 23 at 5:15
Daniel DeulinDaniel Deulin
316
316
Hey Daniel, tried, doesn't work
– Abby
Mar 28 at 7:02
add a comment |
Hey Daniel, tried, doesn't work
– Abby
Mar 28 at 7:02
Hey Daniel, tried, doesn't work
– Abby
Mar 28 at 7:02
Hey Daniel, tried, doesn't work
– Abby
Mar 28 at 7:02
add a comment |
I have been learning about localStorage. I decided to use it on this task. I collected the values that the user inputs when signing up, and 'saved' them on local Storage. I then collected the value the user inputs and 'retrieved' them via local Storage. Here is the code:
$(document).ready(function()
$("#userSignUp").click(function()
$("#signUpForm").show();
$("#signup").hide();
);
$("#userInfo").click(function(event)
var custName = $("#newName").val();
var custEmail = $("#newEmail").val();
var custPass = $("#newPass").val();
localStorage.setItem("name", "Raych") +
localStorage.setItem("email", "raych@gmail.com") +
localStorage.setItem("password", "hey"); ;
$("#userSignUp").text("Thank you for signing up!");
);
$("#userLogIn").click(function()
$("#loginForm").show();
$("#login").hide();
);
$("#userData").click(function(event)
event.PreventDefault;
var currentName = $("#userName").val();
var currentEmail = $("#userEmail").val();
var currentPass = $("#userPass").val();
localStorage.getItem("name") +
localStorage.getItem("email") +
localStorage.getItem("password");
$("#userLogIn").text("You are logged in!");
);
);
add a comment |
I have been learning about localStorage. I decided to use it on this task. I collected the values that the user inputs when signing up, and 'saved' them on local Storage. I then collected the value the user inputs and 'retrieved' them via local Storage. Here is the code:
$(document).ready(function()
$("#userSignUp").click(function()
$("#signUpForm").show();
$("#signup").hide();
);
$("#userInfo").click(function(event)
var custName = $("#newName").val();
var custEmail = $("#newEmail").val();
var custPass = $("#newPass").val();
localStorage.setItem("name", "Raych") +
localStorage.setItem("email", "raych@gmail.com") +
localStorage.setItem("password", "hey"); ;
$("#userSignUp").text("Thank you for signing up!");
);
$("#userLogIn").click(function()
$("#loginForm").show();
$("#login").hide();
);
$("#userData").click(function(event)
event.PreventDefault;
var currentName = $("#userName").val();
var currentEmail = $("#userEmail").val();
var currentPass = $("#userPass").val();
localStorage.getItem("name") +
localStorage.getItem("email") +
localStorage.getItem("password");
$("#userLogIn").text("You are logged in!");
);
);
add a comment |
I have been learning about localStorage. I decided to use it on this task. I collected the values that the user inputs when signing up, and 'saved' them on local Storage. I then collected the value the user inputs and 'retrieved' them via local Storage. Here is the code:
$(document).ready(function()
$("#userSignUp").click(function()
$("#signUpForm").show();
$("#signup").hide();
);
$("#userInfo").click(function(event)
var custName = $("#newName").val();
var custEmail = $("#newEmail").val();
var custPass = $("#newPass").val();
localStorage.setItem("name", "Raych") +
localStorage.setItem("email", "raych@gmail.com") +
localStorage.setItem("password", "hey"); ;
$("#userSignUp").text("Thank you for signing up!");
);
$("#userLogIn").click(function()
$("#loginForm").show();
$("#login").hide();
);
$("#userData").click(function(event)
event.PreventDefault;
var currentName = $("#userName").val();
var currentEmail = $("#userEmail").val();
var currentPass = $("#userPass").val();
localStorage.getItem("name") +
localStorage.getItem("email") +
localStorage.getItem("password");
$("#userLogIn").text("You are logged in!");
);
);
I have been learning about localStorage. I decided to use it on this task. I collected the values that the user inputs when signing up, and 'saved' them on local Storage. I then collected the value the user inputs and 'retrieved' them via local Storage. Here is the code:
$(document).ready(function()
$("#userSignUp").click(function()
$("#signUpForm").show();
$("#signup").hide();
);
$("#userInfo").click(function(event)
var custName = $("#newName").val();
var custEmail = $("#newEmail").val();
var custPass = $("#newPass").val();
localStorage.setItem("name", "Raych") +
localStorage.setItem("email", "raych@gmail.com") +
localStorage.setItem("password", "hey"); ;
$("#userSignUp").text("Thank you for signing up!");
);
$("#userLogIn").click(function()
$("#loginForm").show();
$("#login").hide();
);
$("#userData").click(function(event)
event.PreventDefault;
var currentName = $("#userName").val();
var currentEmail = $("#userEmail").val();
var currentPass = $("#userPass").val();
localStorage.getItem("name") +
localStorage.getItem("email") +
localStorage.getItem("password");
$("#userLogIn").text("You are logged in!");
);
);
answered Apr 9 at 10:20
AbbyAbby
12
12
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55310759%2fcomparing-user-sign-up-info-in-an-array-with-user-login-input%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown