1
How do I get the object option
with Jquery specifically this:
$('#nome_responsavel').blur(function () {
var id = $('option[value="'+$('#nome_responsavel').val()+'data-toggle=p"]').attr('id');
alert(id);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>
<label>Nome</label>
<input type="text" class="form-control" name="nome_responsavel" list="list_nome" id="nome_responsavel" required>
<datalist id="list_nome">
<option id="1" value="teste" data-toggle="p">teste</option>
<option id="2" value="teste2" data-toggle="p">teste2</option>
</datalist>
Would you like to put the data-toogle in this selection is possible? Because I have two data list on the page. And if you both have some equal value it might be a problem.
– Guilherme Costa
@Guilhermecosta, look at the edition. See if it works
– Samir Braga
It worked top. all select options is between []?
– Guilherme Costa
@Guilhermecosta, Whenever you want to select an attribute, yes, it is.
– Samir Braga