Jquery Check if Value Input is in the array

438 Views Asked by At

I want to check if my array contains the Value Input, i want something like that, anyone have an idea on how to do that ?

if(jQuery.inArray($('#ValueInputTitle').val, variableValueInput) !== -1)
 {
    console.log("is in array");}
 else {
    console.log("is NOT in array");
}

1

There are 1 best solutions below

1
charan kumar On

You can use this,

if(jQuery.inArray($('#ValueInputTitle').val(), variableValueInput) !== -1)
    {
    console.log("is in array");}
    else {
    console.log("is NOT in array");
}