JSFiddle - React, Tailwind, and code Playground

by brigand

HTML

<div class="form-group arrow">
  <select class="form-control" id="room-selection">
                                        <option>SELECT A ROOM</option>
                                        <option data-image="/kitchen.png">Kitchen</option>
                                        <option>Washroom</option>
                                    </select>
</div>

JavaScript

const select = document.querySelector('#room-selection');

select.addEventListener('change', function(e) {
  const index = select.selectedIndex;
  const opt = select.children[index];
  console.log(opt)
});