I have the following code:
$(this).children(\"a:eq(0)\").append(\'
The code from the original question may generate errors (using "this" with the selector). Try the following approach:
$("#container-element img:last-child").remove()