I am trying to append the parent node with child node using jquery and object oriented javascript.
Can you please explain why the commented line in the buildexpenseTable function block does not work.
But the next line works fine.
var BUILD = BUILD || {};
BUILD.protoType = {
expenseDiv : function(bearer){
return "<P>hai</p>";
}
}
BUILD.builder = {
bearer : $("#bearer"),
desc : $("#description"),
amount : $("#amount"),
output : $("#outputBlock"),
buildExpenseTable : function (){
//BUILD.builder.output.append($(BUILD.protoType.expenseDiv(bearer.value)));
$("#outputBlock").append($(BUILD.protoType.expenseDiv(bearer.value)));
}
}
bearer.valuemay be falsy since bearer is a jQuery object and hence .value might not work here