I am having trouble displaying a photo from the file URL. I am only getting [Object HTML IMAGE ELEMENT]
on the page even though I think I am pointing this element to the image source.
//database query results...
for(var i = 0; i < len; i++){
theID = results.rows.item(i).id;
console.log(theID);
theName = results.rows.item(i).username;
htmlStr += theName;
console.log(theName);
thePhoto = results.rows.item(i).imagepath;
console.log(thePhoto);
var imageHold= new Image();
imageHold.src = thePhoto;
console.log("this is the src:"+imageHold.src);//THIS IS GIVING ME THE PATH
var userDiv = document.createElement("div");//Create the div
userDiv.innerHTML=htmlStr+imageHold;//IS THE PROBLEM WHAT I AM DOING HERE?
document.getElementById('showUsers').appendChild(userDiv);//append it to the document
userDiv.style.display = 'block';
}
Try
userDiv.innerHTML=htmlStr;
userDiv.appendChild(imageHold);
The htmlStr
should have valid markup.