Home › Forums › Add-ons › Repeater Field › WordPress acf trying to hide and show divs in a list, using acf repeater field
Hi im basically creating a help page, where there is a dynamic list created using the repeater field.
Each list item there is a line of text, that when clicked on should show some more content (and hide it when clicked on again).
Now i can get it to work for the first item in the list… but every new item only shows/hides the first item.
Im assuming i need to do some for each for the id or something i just don’t know how to.
Thx for any help, here is the code:
<?php if (have_rows(‘video_felt’)): ?>
<?php if (have_rows(‘video_liste’)): ?>
</div>
<?php endif;?>
<?php endwhile;?>
<?php endif;?>
<?php endwhile; ?>
<?php endif;?>
<script>
function myFunction() {
var x = document.getElementById(“myDIV”);
If you are still active: Any insight on what jquery did the trick? Doesn’t help other people looking for a solution by just stating you solved it without providing a proper explanation.
You are right im sorry about that.
Its been awhile since i worked on this, but im pretty sure this is fix:
<script>
jQuery(document).ready(function(){
jQuery(‘body’).on(‘click’, ‘ul.videoul li’, function() {
jQuery(“div.myDIV”).hide();
jQuery(this).find(“div.myDIV”).toggle();
});
});
</script>
The topic ‘WordPress acf trying to hide and show divs in a list, using acf repeater field’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.