How do I get a value from a function inserted into my HTML.
I have tried this:
function testReturn(value) {
var ReturnValue = value;
return ReturnValue;
}
html = "<div>' + testReturn(2) + ' </div>";
I get an error saying Undefined
You are mixing quotes and aren’t declaring the variable html
If you want this to then be part of your webpage you have to write it out. To follow in what you are doing:
A better way to do it would be with direct DOM manipulation as such: