You are viewing limited content. For full access, please sign in.

Question

Question

Forms Tables: Is there an event that fires after a new row is fully in place

asked on May 9, 2021

My goal is to calculate a default value for one of the fields in a Forms table every time a new row is added. This will be simple if there is an Javascript event that fires after the new row has been added. This would be sort of like

$(document).ready()

 except that it would be for a new table row instead of for the initial load of the page.

I would also love to hear from anyone who knows a better way to do this.

0 0

Answer

SELECTED ANSWER
replied on May 10, 2021 Show version history

If you're using the conventional table layout with the "Add" text button then you can use the following JavaScript code.

$( document ).ready(function() {
$("#q20").on('click', function(event){
  alert( "Table row added." );
});
});

 

In your code, change #q20 to reference the ID of your Add button. See the screenshot below for where to find it:

1 0

Replies

replied on May 10, 2021

It works! I thought of putting an event handler on click of the "Add" link but I "knew" it couldn't work because I thought my code would run before the line was created.

It's not the first time I've "known" something that didn't end up being true. Thanks for your reply and I hope it helps someone else.

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.