Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8335749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:45:55+00:00 2026-06-09T03:45:55+00:00

I have a js object (it’s actually an object within another object): item2 :

  • 0

I have a js object (it’s actually an object within another object):

item2 : {               
    itemTitle : "This is item 2",
    itemContent : "To me, in France, a friend speaks from America.  The energy that brings me his voice is born of dammed-up waters a thousand miles from where he sits. <p> The energy I burn up in listening to him is dispensed in the same instant by a lake formed in the River Yser..."
},

The two items (itemTitle and itemContent) are displayed in respective p elements within divs, they make up an accordion display (titles displayed, content hidden until title is clicked).

It works fine except when I add content with html tags in it, in this case a p tag. The first paragraph is hidden, the second one is displayed, but since both paragraphs are encased in a p element whose display is set to none I would think both should be hidden.

So I am thinking the browser (Firefox latest) is seeing the p element and rendering that second paragraph. I thought maybe if I closed off the second p element that would take care of it. But no dice.

I’ve spent the last two years doing objective-c stuff so my css/js/html foo is off a bit. Why would the browser display this if it is within a element that is hidden?

Here is how I am generating the html:

//loop through the accordian properties and build out the html code for them
var i = 0;
for (thisItem in accordian.accordianItems) {
    i++;
    var thisItemData = accordian.accordianItems[thisItem];
    var thisItemCode = "<div id=\"itemContainer\" itemID=\"item_" + i.toString() + "\">" + "<div id=\"itemTitle\"><p class=\"title\"><a href=\"javascript:void(0);\" class=\"titleBar\" itemID=\"item_" + i.toString() + "_titlebar\">" + thisItemData.itemTitle + "</a></p></div>" + "<div id=\"itemContent\"><p class=\"content\">" + thisItemData.itemContent + "</p></div>" + "</div>";
    accordianCode += thisItemCode;
}
//push the code out to our container div
$("#accordianContainer").html(accordianCode);

my css:

#itemContainer {
    margin: 0 0 5px 0;
}
.title {
    margin: 0 0 2px 0;
    height: 20px;
    vertical-align: middle;
    background-color: #39F;
    color: #fff;
    font-family: Arial, Geneva, sans-serif;
    font-size: 14px;
    font-weight: 900;
}
.title a {
    color: #fff;
    text-decoration: none;
}
.content {
    margin: 0 0 0 5px;
    color: #333;
    font-family: "Times New Roman", Times, serif;
    font-size: 12px;
    font-weight: 200;
    display: none;
}

Any help would be appreciated.

And yes, I did spell accordion wrong throughout my code, I fixed it there but not here. : P

Edit: Switched the p tags for a br and the problem went away. So my new guess is something with a p being a block item? I guess I could style the br tag but I’d rather have the p’s, any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:45:57+00:00Added an answer on June 9, 2026 at 3:45 am

    Only inline elements are allowed in a p. See http://www.w3.org/TR/html401/struct/text.html#h-9.3.1. The browser is choosing to render it as its own element, which takes it out of the hidden p.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have shared object A.so which statically links to libssl.a & another shared object
I have this object: stdClass Object ( [daily_inventoryID] => 1 [inventory_timestamp] => 2012-06-08 14:35:42
We have Object and ValueType .... And String .... String is derived from object,
Let's imagine that we have object Animal $.Animal = function(options) { this.defaults = {
I have this before the process: protected void onPostExecute(SortedSet<RatedMessage> result) { List<Object> list=Arrays.asList(result.toArray()); lancon.putExtra(results,
I have object A and object B deserialized from binary files. B has a
My questions is next: For example I have object A (this is data model
i have object like this: some_object this object has like 1000 properties. i would
Dear all, this is going to be tough: I have created a game object
But I'm wondering what the naming conventions are for this? Like.. I have object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.