0

I have a JavaScript function which gets the object using document.getElementById.

function updateQuestPartElemement(obj){
  var objid = obj.id;
  var quesids = objid.split("$|$");         
  var qplabelid = quesids[0] + '$|$' + quesids[1] + '$|$' + 'questionPartLabel';    
  alert(qplabelid); //removing this alert, the below object is coming as null
  var qpartlabel = document.getElementById(qplabelid);
  alert(qpartlabel);
}

The issue is I dont need the alert for qplabelid. But if I remove this alert, document.getElementById(qplabelid) is not returning any object. I am confused. Please suggest me something to get the object.

Andy
  • 39,764
  • 8
  • 53
  • 80

0 Answers0