Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions node_modules/normalize.css/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions node_modules/normalize.css/LICENSE.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion node_modules/normalize.css/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 8 additions & 11 deletions node_modules/normalize.css/normalize.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 28 additions & 7 deletions node_modules/normalize.css/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 35 additions & 1 deletion validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,39 @@

$(function(){

//insert your code here
$(".errors li").hide();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My primary comment here would be kind of the same for rapnamegenerator.

  1. Work to extract your logic into separate chunks. https://sourcemaking.com/refactoring
  2. I also don't think your solution would prevent form submission. What's the point of client side validation that doesn't prevent a request from being made to the server?


$("form").on("submit", function(event){

// password needs to be 8 chars long
if ($("input[type=password]").val().length < 8) {
$(".errors li:nth-child(2)").show();
} else {
$(".errors li:nth-child(2)").hide();
};

// password needs to have a capital letter
if ($("input[type=password]").val().match(/[A-Z]/) == null) {
$(".errors li:nth-child(3)").show();
} else {
$(".errors li:nth-child(3)").hide();
};

// password needs to have digit in it
if ($("input[type=password]").val().match(/[0-9]/) == null) {
$(".errors li:nth-child(4)").show();
} else {
$(".errors li:nth-child(4)").hide();
};

// simple validation regex for email
if ($("input[type=text]").val().match(/\S+@\S+\.\S+/) == null) {
$(".errors li:nth-child(1)").show();
} else {
$(".errors li:nth-child(1)").hide();
};


});

});