Check if input field value is included in array - Jquery -


i'm trying fire function if input field's value equal of number in array.

i have code below, doesn't seem work!!

var num1 = $("#people-number").val(); var numberarray = [1,3,5,7,9];  if ($.inarray(num1,numberarray) > -1) {      $("#valid-people").hide();      $("#non-valid-people").fadein();    } 

any tips appreciated.....

it because array has int values , the value testing string

$.inarray(parseint(num1),numberarray) 

demo: fiddle


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -