Javascript examples for jQuery:Array
Search array element with $.inArray()
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.js"></script> <script type="text/javascript"> $(window).load(function(){/* w w w. j a va 2s . c om*/ var statesArray = [10, 15, 19]; // list out all var state = 19; var index = $.inArray(state, statesArray); if(index == -1) { console.log("Not there in array"); } else { console.log("Found it"); } }); </script> </head> <body> </body> </html>