updating values
Hi everyone,
I am trying to update the value which is stored in a particular part of my page by using the getElementsById method, followed by calling a function to update the field. However, I donât know how to do this. The relevant parts of my code are as follows:
function text(t)
{
return document.createTextNode(t);
}
function start(){
var oHelloText = text(getQuestion()); //the getQuestion method returns a string from an array
oHelloText.id = "test";
}
function updateDetails()
{
document.getElementById('test') = text(getQuestion());
}
//sometime later, call to updateDetails method.
Unsurprisingly, this doesnât work.
Any advice?
|