5

I have some Javascript code:

function addRow(tableID, rowId) {
var table = document.getElementById(tableID);
var rowPosition = document.getElementById(rowID).rowIndex;
//etc.
}

But this throws a Javascript error

"Uncaught ReferenceError: rowID is not defined"

Though looking on Firebug, I can see that the functions receives a correct row identifier, but once the code reaches the second line inside the function the parameter rowID seems unknown.

Can anyone help?

2 Answers 2

9

JavaScript is case-sensitive. You've used rowId as the argument name (small "d") while inside the function you have rowID (capital "D"). Change the argument to rowID to fix the issue.

Sign up to request clarification or add additional context in comments.

Comments

4

You're passing the parameter rowId, but referencing it rowID. Variable names are case sensitive, they both need to be the same.

Comments

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.