Jquery how to do image show hid.
Posted
by Michael
on Stack Overflow
See other posts from Stack Overflow
or by Michael
Published on 2010-05-08T14:45:25Z
Indexed on
2010/05/08
14:48 UTC
Read the original article
Hit count: 170
jQuery
I am new to html especially to jquery but I want to show hide a photo on click. I pulled some sample code which is exactly what I want "I did not write this code" and I am wanting to modify the code for an image versus a div. The code is noted below.
I have tried this several different ways and the
My goal:
1. To hide an image versus a div tag
Any help would be wonderful
<!DOCTYPE html>
<html>
<head>
<style>
div { background:#def3ca; margin:3px; width:80px;
display:none; float:left; text-align:center; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<button id="showr">Show</button>
<button id="hidr">Hide</button>
<div>Hello 3,</div>
<div>how</div>
<div>are</div>
<div>you?</div>
<script>
$("#showr").click(function () {
$("div:eq(0)").show("fast", function () {
/* use callee so don't have to name the function */
$(this).next("div").show("fast", arguments.callee);
});
});
$("#hidr").click(function () {
$("div").hide(2000);
});
</script>
</body>
</html>
Show Hide
Test
© Stack Overflow or respective owner