0

I need to get the name of an option item select using javascript but don know how:

<select id="filtro_1" class="form-control" onchange="javascript:atualizaCombos(this);" style="box-shadow: inset 0 1px 1px rgba(0,0,0,.075);">
    <option value="">Todos</option>
    <option value="4">Carros</option>
</select>

I need to get the word "Carros" and not the value=4

Anyone? Thanks in advance!

Marcello Pato
  • 500
  • 6
  • 21

1 Answers1

0
let text = document.querySelector('#filtro_1 option:checked').textContent;
Unmitigated
  • 76,500
  • 11
  • 62
  • 80