As a web developer we needs to do a lot of operations daily on Array. Array is a common data structure which help us to build from simple to complex business logic whatever from server side or from client side. Array is in everywhere. One of the common operation on Array is whether a value exist in Array or not. If exists then we need to the Array index number. Yes here in this article I am going to describe “How we can check a value exists in array or not using JQuery“. The JQuery inArray method provides us the functionality to achieve. Let’s see the implementation of inArray method from below:
To do the Add a Label Control First:
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
JQuery Code to Check whether a Value Exists in Array:
Note: .inArray() is case sensitive.