Let me apologize for my noob javascript and jQuery skills. I am trying display one of two divs based on input from a form. More specifically, I have button next to a form field that prompts users to enter their zip code to check if they are in our service area. If they are, a div with text "saying that yes you are in the service area". If they are not in the service area (!=60614) then a div saying "sorry...." Here is the code I am trying and failing with: Html:
<div class="large-3 small-6 large-centered small-centered columns">
<input type="text" placeholder="Zip Code" />
<a id="checkZipButton" class="button">Check your zip</a>
<!--<div class="zipResultsNegative"><p>Sorry we are not doing pickups in your area yet, but we will be soon. Please sign up, so when we get to your area you will be ready yo go.</p></div>
<div class="zipResultsPositive"><p>We are in you area, so sign up and give us a whirl!</p></div>-->
</div>
JavaScript:
$(function(){
var NewContent=' <div class="zipResultsNegative"><p>Sorry we are not doing pickups in your area yet, but we will be soon. Please sign up, so when we get to your area you will be ready yo go.</p></div>'
var OtherConent= '<div class="zipResultsPositive"><p>We are in you area, so sign up and give us a whirl!</p></div>'
$(".checkZipButton").click(function(){
if (NewContent != '60614') {
$("#checkZipButton").after(NewContent);
NewContent = '';
} else OtherContent ==='60614'{
$("#checkZipButton").after(OtherContnent);
OtherContent = '';
} else{
$('#checkZipButton').next().toggle();
}
});
});
OtherConent,OtherContnentandOtherContent, all referring to the same variable.