I have the following code, which is added dynamically:
var m = 0;
$$("#add_medicamento").click(function(){
m++;
var medicamento = $$("#select_medicamento").val();
var qnt = $$("#quantidade").val();
$$("#lista_medicamentos").append('<li class="swipeout">'+
' <div class="swipeout-content item-content">'+
' <div class="item-inner">'+
' <div class="item-title-'+m+'">'+medicamento+'</div>'+
' <div class="item-after-'+m+'">'+qnt+'</div>'+
' </div>'+
' </div>'+
' <div class="swipeout-actions-right">'+
' <!-- Add this button and item will be deleted automatically -->'+
' <a href="#" class="swipeout-delete">Apagar</a>'+
' </div>'+
'</li>');
})
And I'm trying to get the name of the drug (within the div class="item-title" that is dynamic), and the amount of drugs inserted (within the div class="item-after" which is also dynamic).
I tried the following, but to no avail:
var medicamentos = $$("#lista_medicamentos .item-inner");
medicamentos.each(function(idx, li){
var teste = $(li);
alert(teste);
})
How can I resolve this?