Image appearing when clicking a button
39,754
Solution 1
You were lucky I had a blank HTML page ready:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
<meta charset="utf-8" />
<title>Test</title>
<style type="text/css">
.hidden {
display: none;
}
</style>
</head>
<body>
<form>
<input type="submit" id="submit" onclick="document.getElementById('hidden').style.display = 'block';" />
</form>
<img id="hidden" class="hidden" src="foo.png" />
</body>
</html>
Solution 2
Using jQuery:
<img id="image1" src="myimage.jpg" style="display:none;" width="120" height="120"/>
<input type="submit" name="submit" value="submit" onclick"$('#image1').show()"/>
Author by
Bryan
Updated on December 13, 2020Comments
-
Bryan over 3 years
How do I make a hidden image appear when a submit button is clicked?