Dom library is not working as intended

I’m trying to run following statement:-


Above statements did not run or nothing happens.
Here, element with id 'L'+id exists before the event is fired up and this element is added dynamically(which i believe is the main reason for this abnormal behaviour

Var $$ = Dom7;
This may work
Good luck!!!

I already tried this

Try defining the selector outside of the brackets.

var itemToId = "#L" + id;
$$(itemToId).attr('src', likebutton);