I am adapting a jQuery codebase (its a spinning prize wheel) and decided to add a form input for email, I have tied the .submit to the “spin” .click function, everything works, except I need
the wheel to not spin if the input field is empty. Could someone please look at the code and see where I am going wrong?
$('#spin').one('click', function(){
if $('#login').val() == ''
// exit so the wheel doesn’t spin.
$(".profile-form").submit();
//add 1 every click
clicks ++;
/*multiply the degree by number of clicks
generate random number between 1 - 360,
then add to the new degree*/
var newDegree = degree*clicks;
var extraDegree = Math.floor(Math.random() * 360) + 1;
totalDegree = newDegree+extraDegree;
var colorIndex = Math.ceil(((totalDegree+30) % 360) / 60) -1;
var colorPrev = colorIndex == 0 ? 5 : colorIndex - 1;
var colorNext = colorIndex == 5 ? 0 : colorIndex + 1;
offset = (extraDegree % 60);
var result = sec[colorIndex];
if(offset == 0) {
result;
} else if (offset <= 30) {
result;
} else {
result;
}
$("#answer").html("Congratulations! You've received a " + result);