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

Recommended Answers

All 2 Replies

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 );
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.