|
|
Using innerHTML method instead of addChild in javascript - Javascript
|
Views : 6599
|
|
Tagged in : Javascript
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
> In javascript getElementById() method is used to get the HTML form element with the specified Id.
for example,
var xxx = document.getElementById("idform");
will get the HTML form element with the id "idform" and stored in the variable xxx.
> Content can be added dynamically to the element using addChild method as,
xxx.addChild(someValue);
> Instead of using addChild, innerHTML is also used to add value to the element at run time as,
xxx.innerHTML = 'somevalue';
or you can use,
document.getElementById('idForm').innerHTML = 'someValue';
> When the innerHTML property is set, the given string completely replaces the existing content of the object. |
|
By Ramya, On - 2008-06-18 |
|
|
|