This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
In the following piece of code, I create two elements: title and left.
At this point, I check to see whether these nodes exist or not; they exist and are not null:
However, I receive this error as soon as the script comes to this line: Uncaught TypeError: Cannot read property 'length' of undefined
Looks like the value is not defined for them or its too early to check for the value property?
On the website, I see the fields with the "values" as follows; meaning it does show the values:
TITLE: Auto Body and Paint --> "Auto Body and Paint": is the value
35 characters left --> "35" is the value
Thanks so much. I modified the script to check the title.id and left.id instead of the id of the <div> element. The error is gone, and I don't receive any other error, however, I see the following when the alert() is executed:
Title: found: undefined
Left: found: undefined
Now my elements are found but I expected to see their values: "Auto Body and Paint" and "35". Why they are undefined?
Joined: Nov 01, 2011
I think first I need to refer to the input objects that I have - the following objects or elements - and then get the value from the object:
If my assumption is correct, I have difficulty referring to those objects within the code. I need to find out how can I refer to these two elements, b/c need to pass these elements to other function which then the function tries to access the values: "Auto Body and Paint" and "35".