How to stop an "add/delete table row script" from deleting the last row and how to limit rows?

m_huntley

Hi.

I added the following to the start of my add code:

var rows = $( "#tbl_posts_body tr" ).length;
        if (rows >= 10) {
            return;
        }

Success!

Thank you for your help and for the link you included, particularly for your prompting approach rather than just giving me the answer.

OK, I can tick a new box… JavaScript Guru, tick, done :slight_smile:

2 Likes