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

Question

Question

Forms- on table row addition or deletion- jquery click event not firing

asked on November 29, 2016 Show version history

In Forms- I am trying to count the rows in a table using jquery and stuff the result in a field.  When I try to add or delete rows in the table the click event is not firing and not calling the function.  I think I'm probably missing something obvious so if any jquery gurus can see what's wrong your help would be appreciated!

 

THANKS!!!

Terri

$(function DepartmentApprovalCount() { 
	var acount = ($('.DepartmentTable tr').length - 1);
	$('.DepartmentApproverCount input').val(acount);
});

$('.DepartmentTable').on('click', function() {
	DepartmentApprovalCount();
});

0 0

Answer

SELECTED ANSWER
replied on November 29, 2016

There was js error with your code.

Try this:

$(function(){
  function DepartmentApprovalCount() { 
	var acount = ($('.DepartmentTable tr').length - 1);
	$('.DepartmentApproverCount input').val(acount);
  }	
  $('.DepartmentTable').on('click', function() {
    DepartmentApprovalCount();
  });
  DepartmentApprovalCount();
});

 

1 0

Replies

replied on November 30, 2016

Thank you Rui- That worked perfectly!!!

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

Sign in to reply to this post.