I'm trying to add a data-id
to objects that will be created dynamically, well the point is I want to do this as soon as the document or my object loads without the need to click etc, see the way I tried.
For example:
$(document).on('ready','.letras',function(){
$(this).attr('data-id',faixas2[k]['id_faixa']);
});
or
$(document).on('ready', function(){
$('.letras').attr('data-id',faixas2[k]['id_faixa']);
});
It does not roll at all.