I have the following autocomplete defined in HTML
HTML
<label class="input">
<input type="text" list="list" id="entidade" placeholder="Cliente" onblur="dadosCliente ( )">
<datalist id="list">
@for(entidade <- entidades) {
<option name="ent" id="@entidade.getId()" value="@entidade.getNome()">@entidade.getNome()</option>
}
</datalist> </label>
Autocomplete is working fine, DB data is being fetched. How can I now in jQUERY
get the ID of the selected element?
I have tried this: $("option[name=ent] :selected").attr('id');
but returns undefined. Any Suggestions?