JSFiddle - React, Tailwind, and code Playground
HTML
<select>
<option>test1</option>
<option>test2</option>
<option>test3</option>
<option>test4</option>
<option>test5</option>
</select>
JavaScript
$('option:nth-child(n+1)').wrapAll('<optgroup label="Urgent Reasons">');
$('option:nth-child(n+4)').wrapAll('<optgroup label="Urgent Reasons">');