JSFiddle - React, Tailwind, and code Playground

by Matthew Day

HTML

<form name="check">

  <input id="hey" type="text" />
  <div id="submit" class="">Submit</div>

</form>

JavaScript

var arr1 = [];

$('#submit').click(function(e) {
	e.preventDefault();
	var el = $('#hey').val();
  if(arr1.indexOf(el) > 0) {
    console.log('This value is already in the array.')
  } else {
    arr1.push(el);
  }
  console.log(arr1);
});