javascript - Get custom atrribute value with JQuery of an datalist -


im trying value of custom attribute in datalist no success, can me?

the datalist

<div class="form-group col-md-6">      <label for="sel_cidade">cidade</label>      <input type="text" name="sel_cidade" id="sel_cidade" list="sel_municipio" class="form-control">      <datalist id="sel_municipio" name="sel_municipio">          <?php              foreach ($selectmunicipioibge $r ) {                 echo '<option data-value="' . $r->cidadecodigo . '">' . $r->cidadenome;              }          ?>      </datalist>      <input type="hidden" name="sel_cid" id="sel_cid"> </div> 

the jquery

$("#sel_cidade").on("change", function () {     console.log($("#sel_municipio").val($("#sel_municipio").attr("data-value"))); }); 


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -