IN statement jquery to search array element - Javascript jQuery

Javascript examples for jQuery:Array

Description

IN statement jquery to search array element

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script> 
      <script type="text/javascript">
    $(function(){//from  w  w w  .j av  a2s . c  o m
var arr=["One","3","Two","test","Red"];
var urname="Two";
if(jQuery.inArray( urname, arr ) != -1){
    console.log("yes");
}else{
console.log("no");
}
    });

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials