Last active
April 12, 2016 01:33
-
-
Save JimboFromLimbo/92620fc8015b9d3a2e3408d6f3fc5e79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var required1 = false; | |
var required2 = false; | |
var required3 = false; | |
var required4 = false; | |
$('.button').click(function() | |
{ | |
if ($('.required-details').css('display') !== 'none') | |
{ | |
($('.required-personal').each(function(index, e) | |
{ | |
if ((e) === '') | |
{ | |
console.log ( 'required personal error was succesfull'); | |
var required1 = false; | |
$(e).css | |
({ | |
'border-color': 'red' | |
}); | |
} | |
else if ((e) !== '') | |
{ | |
console.log ("required1 var = true") | |
var required1 = true; | |
} | |
})) | |
} | |
if ($('.required-form-contact').css('display') !== 'none') | |
{ | |
($('.required-contact').each(function(i, e) | |
{ | |
if (($('.required-contact').val()) === '') | |
{ | |
var required2 = false; | |
console.log ( 'required-contact error was succesfull'); | |
$(this).css | |
({ | |
'border': '1px solid', | |
'border-color': 'red' | |
}); | |
} | |
else if (($('.required-contact').val()) !== '') | |
{ | |
console.log ("var required2 = false") | |
var required2 = true; | |
} | |
})) | |
} | |
if ($('.residential').css('display') !== 'none') | |
{ | |
($('.required-address').each(function(i, e) | |
{ | |
if (($('.required-address').val()) === '') | |
{ | |
console.log ('required-address error was succesfull'); | |
var required3 = false; | |
$(this).css | |
({ | |
'border': '1px solid', | |
'border-color': 'red' | |
}); | |
} | |
if (($('.required-address').val()) !== ''){ | |
var required3 = true; | |
} | |
})) | |
} | |
if ($('.postal').css('display') !== 'none') | |
{ | |
($('.required-postal').each(function(i, e) | |
{ | |
if (($('.required-postal').val()) === '') | |
{ | |
console.log ( 'required-dropdown'); | |
var required4 = false; | |
$(this).css | |
({ | |
'border': '1px solid', | |
'border-color': 'red' | |
}); | |
} | |
if (($('.required-postal').val()) !== '') { | |
console.log ('postal compelte') | |
var required4 = true; | |
} | |
})) | |
} | |
if (required1 = true){ | |
console.log ('It has reached the last if pt 1') | |
if (required2 = true){ | |
console.log ('It has reached the last if pt 2') | |
if (required3 = true){ | |
console.log ('It has reached the last if pt 3') | |
if ($('.postal').css('display') !== 'none'){ | |
if (required4 = true){ | |
console.log ('p4 is true with postals') | |
} | |
} | |
else if (required4 = true) { | |
console.console.log(' require 4 = true without postal'); | |
} | |
} | |
} | |
} | |
else | |
{ | |
$(this).not('.button').css | |
({ | |
'border': '1px solid', | |
'border-color': '#ccc' | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment