My problem is that I don't know how to show the innerHTML
of my form.
The form is like a survey form and once you clicked the submit button, all the contents I had answered would show like a summary page...
function displayResult() {
var first = document.getElementById("first").value;
var middle = document.getElementById("middle").value;
var last = document.getElementById("last").value;
var maincontent = document.getElementById("content").innerHTML;
maincontent = "<p>" + first;
}
"
. – Pedateelement.innerHTML
is a property, with a getter and setter. You can't get a reference to it as a node, because when you call it directly likevar content = domelement.innerHTML;
, you get it's value in a string, not a reference to it like a function. So you have to pass the.innerHTML
down to the next line and use it with the node reference. – Salmagundi