Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript WP loop with jQuery (without page reload)

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #197492
    mikedorrphoto
    Participant

    Hello,

    I have an unordered list of my blog post tags on a page in WordPress. Underneath the list, I have a results div where, when a tag is clicked, I’d like to display a list of posts that have that tag. I would like this to happen without reloading the page. I can’t figure out how to access a list of posts through jQuery. Any help would be fantastic!

    Here is my code:

    <ul id="tagList">
        <li><a href="#">Rock</a></li>
        <li><a href="#">Blues</a></li>
        <li><a href="#">Jazz</a></li>
        <li><a href="#">Country</a></li>
        <li><a href="#">Classical</a></li>
    </ul>
    
    
    
    <div id="results">
        <ul>
            <!-- If "Rock" is clicked, it would show an <li><a href="/link-to-blog-post/">Post Title</a></li> for each post with the tag "Rock". -->
        </ul>
    </div>
    
    #197499
    mikedorrphoto
    Participant

    nkrisc,

    Thanks for the reply. I agree with your answer. That’s exactly what I will need to do. My issue is that I can’t seem to figure out how to do it. I would definitely like to learn how to code it, rather than using a plugin, but I haven’t been able to wrap my head around it yet.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.