Codepedia
.info
Home
jQuery
Angular
Asp.net
Asp.net Core
Sql
Demos
Tools
SVG Wave Generator
Twitter Trends
Colors
Coupons & Deals
Back to Article :
How in jQuery Check if Value Exists In Array or Not ?
Edit This Code :
<html> <head><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> </head> <body> <script> $(document).ready(function(){ var arrFruits = ['apple', 'mango', 'orange', 'grapes', 'banana']; if ($.inArray('mango', arrFruits) >= 0) { console.log('Value exists in Array variable'); } else { console.log('Value Not exists'); } }); </script> </body> </html>
➤ Run / View
❱❱ View Article
Result :