JQuery Array in Array
From w3cyberlearnings
Contents |
jQuery Find Array Element
Uses inArray() function to find the element index within array.
Syntax $.inArray()
- seek is the element to seek within array
- array is the array
jQuery.inArray(seek,array);
Example 1 TRY-IT
$(document).ready(function() { var myList =[1,5,6,23,53]; alert(jQuery.inArray(53,myList)); });
Output
4
Example 2 TRY-IT
$(document).ready(function() { var myList =['apple','toshiba','nokea','lcd']; alert(jQuery.inArray('nokea',myList)); });
output
2
Related Links
- Find Element in Array
- Get Array Size
- Eliminate Duplicate Array Element
- Loop through Array
- Turns Array to string