Elements are dynamically generated, so it does not exist in the DOM. My case is the following:
<div class="ui-grid-a">';
<div class="ui-block-a">'+row.nome_item+' id '+row.id_item_conta+'<div class="valor_quantidade" quantidade_item="'+quantidade+'">'+quantidade+' X '+row.valor_item+'</div></div>
<div class="ui-blok-b"><a href="javascript:0" id_item_conta="'+row.id_item_conta+'" class="ui-btn ui-icon-plus ui-btn-icon-right soma_item_conta" style="background: none; border: none;float:right;margin-top:5px;"></a><a href="javascript:0" id_item_conta="'+row.id_item_conta+'" class="ui-btn ui-icon-minus ui-btn-icon-right diminui_item_conta" style="background: none; border: none;float:right;margin-top:5px;"></a></div>
</div>
These elements are dynamically generated and placed within a div
with given id
:
<div id="conta_selecionada"></div>
So long, notice that there is a link with class soma_item_conta
to recognize this link is easy because there is an event attached to it. >
$('#conta_selecionada').on('click','.soma_item_conta',function(){
//alert('TETSE');
});
But then my problem begins. I need to retrieve the value of the quantidade_item
attribute that was dynamically generated along with the link a
... But as it has no event attached to it I can not recover along with on
.
Does anyone have a solution?