I have the following DIVS:
<div id="img_btn2"><a href="#modal1" class="modal-trigger btn-flat"><i class="material-icons icone_branco">alarm</i></a></div>
<div id="img_btn"><i id="img_lamp1" class="material-icons icone_branco">lightbulb_outline</i></div>
<div id="nome_btn1" align="center">QUARTO</div>
<div id="botoes" class="row" align="center">
<div class="switch" align="center"><label>Desligado<input id="btn_cliente_on1" class="btn_onoff" value="http://192.168.10.102" type="checkbox"><span class="lever"></span>Ligado</label></div>
</div>
And I want to get the TAG ID i , via JQuery, but I'm not getting closest.
$(document).on('click', '.btn_onoff', function(){
var id = $(this).attr('id');
var target = $(this).closest('i').attr('id');
var cmd = $(this).val();
console.log(target);
});
How to solve ??