Hi Everyone,

I created a script where rows gets cloned, then I created a script to check if a specific code exists in the database. This all works fine. My problem is my status message when a code exist, it shows on the first row but not the rest. I made the id of #status unique but I can't understand why it's not showing in the dynamically created row.

Can someone please tell me what I'm doing wrong, or just lead me in the right direction?

I added my code to Jsfiddle

4 Years
Discussion Span
Last Post by hielo

Not sure about the [] character in your id and name values, is that causing them to fail to be found? I always stick with the basic rule for ids, which I think is:


On line 11 you have:

$('.codeForm tr:last div[id="status"]').attr('id', '#status' + counter + '');

which ends up generating <div id="#status">...</div>. Get rid of the hash symbol. You need the hash symbol only when using selector expressions for jquery, not for the actual ids of the elements. It should be:

$('.codeForm tr:last div[id="status"]').attr('id', 'status' + counter );

Edited by hielo

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.