Willy Nguyen
Willy Nguyen

Reputation: 19

Jquery Check if Value Input is in the array

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");
}

Upvotes: -3

Views: 437

Answers (1)

charan kumar
charan kumar

Reputation: 2157

You can use this,

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

Upvotes: 1

Related Questions