I have the following jQuery to make sure that a proper email address is in the input and they have also checked a checkbox for a modal to show. Here is the markup:
// reveal modal if info is filled out correctly
$('.hero--input_button').click(function() {
if (($('.hero--input_check').is(":checked")) && ($('.hero--input_text').val().length >= 8)) {
$('#cta-modal').addClass('modal--show');
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form id="email_signup" method="GET" target="_blank" novalidate="novalidate">
<div class="klaviyo_field_group">
<input type="email" value="" name="email" id="k_id_email" placeholder="Your email" class="hero--input_text" />
<input type="checkbox" name="subscribe" value="yes" id="form--check_two" class="hero--input_check" checked />
</div>
<div class="klaviyo_form_actions">
<button type="submit" class="hero--input_button">Subscribe</button>
</div>
</form>
If I take out the last bit from the if statement (regarding the .hero--input_text) the code works fine. Just then people can hit the button and see the modal without entering an email address!
I know something is wrong with my code but I am not sure what. Any help or advice is greatly appreciated.