Hello, friends today you will learn jQuery inArray() function example. The jquery inarray function is used to check value exists or not in the array. Here I will show how to use the inarray function in jquery.
Example:
<!DOCTYPE html>
<html>
<head>
<title>jQuery inArray check if value exists in Array</title>
<script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
var myArray = ['React', 'jQuery', 'Laravel'];
if (jQuery.inArray('jQuery', myArray) >= 0) {
console.log('jQuery is exist!');
} else {
console.log('jQuery does not exist!');
}
</script>
</body>
</html>
I hope you understand of jquery inarray function and it can help you…