0

I know this is simple but for some reason i am unable to make this work i do not know what i am doing wrong. anyways the purpose for this code is to give an alert box when the element exists inside the array, names

$(doucment).ready(function () {
    var names = ["peter", "John", "mary"];

    if (jQuery.inArray("mary", names)) {
        alert('found');
    }
});

https://jsfiddle.net/jfho9f2q/

Tushar
  • 85,780
  • 21
  • 159
  • 179
kunz
  • 1,063
  • 1
  • 11
  • 27

0 Answers0