get the data-value with JavaScript [duplicate]

0

I'm trying to get the value of the date field from a select, but I'm not getting it. Only the default value field I'm getting.

The field in select is as: "data-value2"

Using .valor2

HTML:

<selectonchange="verificaHierarquia(this)" class="form-control"
  id="hierarquia" name="hierarquia.id">
  <option value="" data-valor=0 selected>SELECIONE...</option>
  <c:forEach var="hierarquia" items="${hierarquias }">
    <option value="${hierarquia.id }"
      data-valor2="${hierarquia.nivel }">${hierarquia.descricao }</option>
  </c:forEach>
</select>
    
asked by anonymous 02.10.2018 / 17:48

0 answers