I am trying to create an info window for Google maps and need to generate a dynamic form to display information.
The following scripts generates an error called "No_found_err: DOM exception 8":
//create objects for HTML elements
var inputElement1 = document.createElement("input");
var inputElement2 = document.createElement("input");
//assign different attributes to the element
inputElement1.setAttribute("type", "text");
inputElement1.setAttribute("id", "poiName");
inputElement2.setAttribute("type", "textarea");
inputElement2.setAttribute("id", "poiDesc");
//create style tag, atrributes and values
//add css style to head tag and define classname for HTML "desctag" element
var cssNode = document.createElement("style");
cssNode.setAttribute("type", "text/css");
cssNode.style.cssText = ".cssClass {vertical-align: text-top; width: 250px; height: 150px }";
document.getElementsByTagName("head")[0].appendChild("cssNode");
document.getElementById("poiDesc").className = "cssClass";
var formString = "<b>Enter location details:</b>
<p>Name: " +
" " + inputElement1 + "<br>Description: " + inputElement2 +
"<p><center>" + "<input type='button' id='saveBtn' value='Save' onclick='savePOI()'>
</center>";
//insert values into the form elements
document.getElementById("poiName").value = locList[i].name;
**document.getElementById("poiDesc").value = locList[i].desc;**
This error appears in between the last two lines. Does it mean that the tag id "poiName" and/or "poiDesc" have not been created?
How can I solve the above problem?
Thank you.
locList?