This is the toggle function without using a php variable as the div ID. The div ID that will be getting toggled is div3 in the code below.
<script>
function showFormcaster() {
$('#div3').toggle();
}
</script>
Because I am making a status system with many replicated divs I need the div id to be unique for each div that contains the reply box and submit button. I have decided to use the id from the status that will be getting replied to as the div id that will get toggled.
This is the div that will get toggled
$mail .= '<div id="'.$status_id.'?>" class="replyholder">';
below are a few methods I have tried to get this to work
METHOD1:
<script>
var show;
show = "'.$status_id.'";
function showreply() {
$(show).toggle();
}
METHOD 2:
<script>
function showreply() {
$('#<?php echo $status_id ?>').toggle();
}
</script>
METHOD 3
<script>
function showreply() {
$('#<?php $status_id ?>').toggle();
}
</script>
I am not so good at Javascript and most of the time when I come to using it, it is guess work and Google however I can't seem to find an answer and what I have found I have tried.
Is it even possible to do what I am trying to do and if so do you think you will be able to help me out and solve this.
Thank you.
showreply()called?$mail .= '<button class="replybutton" onclick="showreply();">Open Reply</button>';That is how I callshowreply()