Hi guys

Any ideas why this is returning undefined?

PHP Code:
function get_question_id(element,needle) {
    
    
parentElement element.parentNode;
    
    if(
parentElement.className == needle) {
        for(
i=0i<parentElement.childNodes.lengthi++) {
            if(
parentElement.childNodes[i].id == "question_id" ) {
                
alert(parentElement.childNodes[i].value); // ok
                
return parentElement.childNodes[i].value;
            }
        }
    } else {
        
get_question_id(parentElement,needle);
    }
}

function 
add_answer(element) {
    
alert(get_question_id(element,'question')); // undefined