-3

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 Answers1

1

You can use this,

if(jQuery.inArray($('#ValueInputTitle').val(), variableValueInput) !== -1)
    {
    console.log("is in array");}
    else {
    console.log("is NOT in array");
}
charan kumar
  • 2,119
  • 2
  • 20
  • 26
  • Firstly please explain your answers to the OP in order to educate them. Just providing code helps no one in the long term. Also note that this issues is a very basic typo, which should be closed as such. – Rory McCrossan Jul 09 '18 at 12:36