0
I am using jquery / php to access the user’s camera and take a photo for a registration. And on the page change user data I need that when uploaded show the photo recorded in the bank in a div "photodb" and when you click the photo take button appear the new image in another div "photo" hiding the div of the photo recorded in the database. As is the code below I can load the page with the photo of BD but when clicking take photo I disable and do not know how to make appear the div photo that is hidden by default.
<?php
<div class='contentarea'>
<div class='camera'>
<video id='video'>WEBCAM não encontrada!</video>
<button id='startbutton' class='btn-toggle' data-element='#photodb'>Tirar foto</button>
</div>
<canvas id='canvas'> </canvas>
<div id='photobd'>
<img src='gera.php?id=$id' border='1'>
</div>
<div id='photo' class='output' style="display: none">
<img src='' border='1'>
</div>
</div>
?>
I can’t use the onclick event because the jquery function already captures the click and tried to use the event screwed up what is working. I used a function found here in the forum show/hide div and I can hide the div photodb but I don’t know how to make div photo appear.
<script>
$(function(){
$(".btn-toggle").click(function(e){
e.preventDefault();
el = $(this).data('element');
$(el).toggle();
});
});
</script>
after this how do I change the display:None of div photo to appear?
If photobd is id, no need to locate the div to be hidden using a data-element on the button. You are generating unnecessary attributes.
– Brunno Vianna