I am attempting to run two different functions which do two separate things. Both need to run when a div is clicked on. The div is generated in the innerHTML function of JavaScript.
This is the method that runs second. It takes one parameter and then generates a div on the page.
//Display larger image:
function furtherDetails(mainImage){
var moreInfo = document.getElementById('divpropertyInfo');
moreInfo.innerHTML = '<div id="propInfoDisplay">' +
'<img id="image" src="'+mainImage+'" alt="Main Image" />' +
'</div>';
}
This is the code that runs that function:
//Create the property div:
function createPropertyDiv(mainImage, bedrooms, bathrooms, parkings, price, address, latitude, longitude){
var propertyDiv = document.getElementById('divsearchResults');
propertyDiv.innerHTML += '<div id="divResults" onclick="showMap('+latitude+','+longitude+');furtherDetails('+mainImage+');">' +
'<img id="mainImage" src="' + mainImage +'" alt="Main Image" />' +
'<p id="numBedrooms">'+ bedrooms +'</p>' +
'<img id="bedroomsImage" src="/images/bedrooms.png" />' +
'<p id="numBathrooms">'+ bathrooms +'</p>' +
'<img id="bathroomsImage" src="/images/bathrooms.png" />' +
'<p id="numParking">'+ parkings +'</p>' +
'<img id="parkingImage" src="/images/carspots.png" />' +
'<p id="Price">'+ price +'</p>' +
'<p id="addressHeading">Address: </p>' +
'<p id="Address">' + address + '</p>' +
'</div>';
}
I am getting the error:
Uncaught SyntaxError: missing ) after argument list
(&)