Update for new question code.
There are 2 problems:
The recently updated OP code has
[@id$='-0']-- which the original question did not. For current versions of jQuery, this should be[id$='-0'].The nodes are cloned but never added to the DOM. Use something like:
var Entry0 = $('#' + tag + '-Entry-0'); var newRow = Entry0.clone().attr('id', newDivId); //console.log ('New row cloned. DivId: ' + newDivId); Entry0.parent ().append (newRow);before trying to get the ids.
There is nothing wrong with the code you posted. The problem is in something that you haven't shown us yet.
Post your HTML and the FULL JavaScript. Ideally post a minimal, but complete, sample that duplicates the problem.