Your error is here :
onerror="this.onerror=null;this.src="https://stackoverflow.com/questions/25486756/+defaultimage+""
After the interpretation, it look like this :
onerror="this.onerror=null;this.src=images/emptyimage.jpg"
You need to wrap your variable to make it a string once the javascript interpreted :
onerror="this.onerror=null;this.src=\'"https://stackoverflow.com/questions/25486756/+defaultimage+"\'"
0
solved Uncaught ReferenceError: emptyimage is not defined