How do I write this in jquery? I want to display a image 600×400 inside the div block on click?
<script>
function displayImage() {
document.getElementById("demo").innerhtml ="image.jpg";
}
</script>
<form>
<input type="submit" onClick="displayImage()">
</form>
<div id="demo">
</div>
However, “image.jpg” is not HTML. So you should just use:
If you are trying to add an image to the div, use: