我需要使用HTML和JS隐藏图像显示代码 [英] I need hidden image show code with HTML and JS
本文介绍了我需要使用HTML和JS隐藏图像显示代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
i把图像作为答案,但它会被隐藏,直到用户点击按钮才能看到它
通知:代码将在同一页面中重复与另一个答案的另一个图片
这个很好的代码是什么?
我尝试了什么:
i尝试使用代码,但是当我用另一张图片重新制作时,指向同一张图片
代码是
hello
i put an image as an answer but it will be hidden till user click a button to see it
notice: the code will be Repeated in the same page with another pics for another answer
what is the nice code for that ?
What I have tried:
i tried with a code but when i repaste it with another pic makes pointing for the same pic
the code is
<pre><a id="show_image">Show Image</a>
<img id="my_images2" style="display:none"
src="https://i49.servimg.com/u/f49/19/59/89/07/02010.jpg">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('#show_image').on("click", function(){
$('#my_images').show('slow');
});
});
</script>
推荐答案
( document )。ready( function (){
(document).ready(function(){
( ' #show_image')。on( 单击, function (){
('#show_image').on("click", function(){
(' #my_images')。show(' slow ');
});
});
< / script >
('#my_images').show('slow'); }); }); </script>
这篇关于我需要使用HTML和JS隐藏图像显示代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文