0

thr below is my code, i try to make tdsum an array, but some how error shows up and i cannot fix it no matter what i did, can anyone please help me, i have tried to replace ntr with numbers and other characters, but it does not work either, so i suspect that there is something i missed that is not related to the ntr part

var tdsum = [];
function find(element,ntr) {
  alert(element.cells[0].innerHTML);
  var tr_sum = element.parentNode.childElementCount
  var tdsum[ntr] = element.childElementCount;
  alert(ntr);
  alert(tdsum[2])
}
$('#row2').click(); 

1 Answer 1

1

You don't declare elements in an array. You only need to declare the array itself.

Remove the var on this line:

tdsum[ntr] = element.childElementCount;
Sign up to request clarification or add additional context in comments.

1 Comment

@EnRicoLam Great! Don't forget to mark this as the answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.