So I am trying to create a script that will display certin message and the button after users inserts specific numbers into #ninja_forms_field_88. So basically, if the zipcode is 60515 display yes + button, if not display no and no button.
So I got it to work if the var is 1 to (yes) any other one (no)
Now, since this willbe a zipcode validator I need to makes sure I can insert more than one unique number - I've tried doing new Array [1,2,3]; but no success and to check it with zipCode == inputZip, I've tried using inArray but w/o success.
Here is the code:
<script>
jQuery(document).ready(function() {
jQuery("#ninja_forms_field_88").keyup(function() {
var zipCode = 1;
var inputZip = jQuery("#ninja_forms_field_88").val();
if (jQuery.inArray("zipCode") == inputZip) {
jQuery("#yes").css("display", "block");
jQuery("#no").css("display", "none");
jQuery("#ninja_forms_field_90").css("display", "block");
}
else {
jQuery("#no").css("display", "block");
jQuery("#yes").css("display", "none");
jQuery("#ninja_forms_field_90").css("display", "none");
}
});
});
Aucun commentaire:
Enregistrer un commentaire