WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Getting content to hide using jQuery - solved CSS naming problem (1 post)

  1. bravenewniche
    Member
    Posted 5 years ago #

    I'm using jQuery to toggle some content on a page displaying multiple posts, and here's something that might save you some time.

    I couldn't get the content to hide when I use 'the_content()', but if I manually put in some text, it worked fine.

    Turned out, it was the fact that 'the_content()' contains '<p>' tags from WordPress, and that was clashing with the CSS I had set up in my template.

    Originally I had the content area set as '<p class="itembody">' but it only worked when I set it as '<div class="itembody">' I tried to have jQuery look for all '<p>' tags within "itembody" and maybe there was a way to make that work and I just didn't understand how (tried the child symbol > but that didn't work).

    The resolution came by changing "itembody" to a div instead of a p.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.