Showing a hidden div once the user has voted?
-
I have a div which is initially hidden and I want it to show once the user has voted and the results are shown. I want the hidden div to append to #polls-1. Normally, I would just use the poll templates in the admin section, but the content that I am trying to append is a php statement which calls for a contact form (Contact Form 7). So since I can’t insert shortcodes or anything but HTML into the poll templates, I had to resort to other methods.
So far, I have this, but it’s not working. When the user clicks on the vote button (
.Buttons
), the div.comment-block
is supposed to get cloned and appended to#polls-1
. If anybody can help me out, I’d really appreciate it.$('.Buttons').on('click', function () { var commentBlock = $('.comment-block'), cloneComment = $('.comment-block').clone(); commentBlock.remove(); $('#polls-1').append('.comment-block').show(); });
<div id="polls-1"> (poll here) + .Buttons vote button <-- in here----------| </div> | <div class="comment-block" style="display:none"> <-- I want this div | <?php echo do_shortcode('[contact-form-7]'); ?> </div>
- The topic ‘Showing a hidden div once the user has voted?’ is closed to new replies.