In this Post We Will Explain About is JQUERY TO CHECK WHETHER VALUE EXISTS IN ARRAY OR NOT? With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Check if value exists in Array – jQuery and JavaScript Example

In this post we will show you Best way to implement inArray – checking for a value in an array, hear for How to Check Value Exist in Array using Javascript/Jquery with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Read Also:  Simple JQuery Ajax Request Example with Laravel 6

How to Check if A Value exists in Array Jquery

In this Example,First of all Add or Inluce External Libs Like as a(jQuery, css etc..), and then create a simple index.php or index.html page.After that crate a simple javascript file like as a index.js or main.js, It is also add your web-application First Header Part to some priorty set.After that Include your relavant CSS Class.

jQuery’s Introduction: In this Post We Are going to Learn how to find some whether specified data value/people check conditions exists in array or not using simple javascript’s based jQuery’s using $.inArray() as well as javascript’s indexOf() methods.

Read Also:  jquery $.inArray Method with Example

The $.inArray() function is also simple similers to JavaScripts native based .indexOf() function in that it simple returns -1 when it doesn’t exists or not find a particuler value match and returns the array index of the HTML element if found.


    <title>How to Check Value Exist in Array using Javascript/Jquery</title>
<script type="text/javascript">
        function check_people() {          
            var officer_list = ['Jawaharlal Nehru', 'Gulzarilal Nanda', 'Lal Bahadur Shastri', 'Indira Gandhi', 'Morarji Desai', 'Charan Singh', 'Indira Gandhi', 'Rajiv Gandhi'];
            var people = $('#peopleslogan').val();
if ($.inArray(people, officer_list) != -1) // or if (officer_list.indexOf(people) != -1)
                $('#display_msg').html(people + ' found');
            else {               
                $('#display_msg').html(people + ' not found');
    <input type="text" id="peopleslogan" />
       <button type="button" onclick="check_people();">Submit</button><br /><br />
 <span id="display_msg"></span>


You are Most welcome in my youtube Channel Please shubscibe my channel. and give me feedBackMore Details……
Angularjs Example

Read Also:  INSERT Multiple Records in Laravel 5.8


I hope you have Got What is javascript – Jquery, checking if a value exists in array or not And how it works.I would Like to have FeaeBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  PHP artisan dump-autoload Fix "class not found"
  2. Read Also:  Jquery check if value exists in Array Example
  3. Read Also:  Very Simple PHP Script to Upload Image or file from an URL
  4. Read Also:  Angular 6 Chart Example using Charts Package
  5. Read Also:  Vue JS Get index in v-for loop Example with Demo
  6. Read Also:  jQuery DataTables Pagination Size Per Page
  7. Read Also:  check if all values in array are true javascript
  8. Read Also:  Check if value exists jQuery in Array – jQuery.inArray()
  9. Read Also:  javascript length of string
  10. Read Also:  Json object check if value exists Example