+1  A: 

Update for new question code.

There are 2 problems:

  1. The recently updated OP code has [@id$='-0'] -- which the original question did not. For current versions of jQuery, this should be [id$='-0'].

  2. 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.

Brock Adams
I just edited the post to include the HTML and the rest of the code.
resonantmedia
I will work on a sample. This code is behind a vpn right now so I will have to build a minimal example.Hopefully what I posted will help until then.- JS
resonantmedia
@resonantmedia: updated answer to match the new question-code.
Brock Adams
A: 

Thanks for all the help.

The problem was actually that the cloned row was not shown yet and needed to be referenced as 'newRow' instead of as $("#" + newDivId).

Once I changed that, it works like a champ.

Not quite sure why that is the case, but that makes it worse.

resonantmedia
The original code (and my answer) searches the DOM -- and would find your nodes if they were inserted into it. Your new code operates on the cloned elements only (which is preferred). You must still insert the cloned nodes. Maybe you actually insert them in later code, which wasn't shown in the question?.
Brock Adams