Results 1 to 1 of 1

Thread: Issue with DOM code and getAttribute

  1. #1
    Join Date
    Apr 2012

    Issue with DOM code and getAttribute

    I am having an issue with some DOM code.

    The code exists within an object and is called by an ajax callback, but I don't think that is my issue, but I could be wrong, it has happened before

    The below code generates the following error on the FireFox Console: "TypeError : reviewDiv is undefined".
    Then it still goes ahead and correctly prints "individualReviewDiv" which is generated by
    I know the code does not make sense but it is to debug the issue.

    Please advise as I am relatively new to web development and am at a stand still. Any help is appreciated.

    reviewChildren = mySelf.parentDiv.querySelectorAll(".individualReviewDiv");
    			console.log(reviewChildren.length + " reviews");
    			for (var i=0; reviewChildren.length; i++) {
    				var reviewDiv = reviewChildren[i]; 
    				reviewIndex = reviewDiv.getAttribute("class"); //<----error on this line
    Last edited by BlueGhost; 02-05-2013 at 10:05 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center