JSFiddle - React, Tailwind, and code Playground

HTML

<div>
  <h1>Item 1</h1>
  <h1>Item 2</h1>
  <h1>Item 3</h1>
</div>
<select style='display: none;'></select>

JavaScript

$("div h1").each(function(i, el){
	$("select").append("<option value='"+i+"'>"+el.innerHTML+"</option>");
});
$("select").show();