javascript - adding data to DOM -
As far as I have seen, no one has specifically addressed this method due to the document. GetElementsByClassName I am calling, but I can not understand why this will not work. Here's the intent to add the value (string) to the page. I have identified an existing device named after class and just added a text node, after which the data item, "account name:" should be displayed. Obviously there is something wrong with my syntax or argument but I can not see it.
Can someone shed some light on me?
this.updateUname = function () {var NewNode [0] = getElementsByClassName ('ACC'); Var div = document.createTextNode ('div'); Div.innerHTML = "Account name:"; NewNode.appendChild (div); } Thanks, Ajfbiz in advance
Change:
var newNode [0] = getElementsByClassName ('ACC'); to
var newNode = document.getElementsByClassName ('ACC') [0]; Here's a bella:
Comments
Post a Comment