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 8350295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:16:17+00:00 2026-06-09T08:16:17+00:00

I am having an issue with showing and hiding two divs. I have two

  • 0

I am having an issue with showing and hiding two divs. I have two links: “Write Post” and “Send Message.” For some reason, to get either div to appear I have to click the link twice. I thought it might be that I was attempting to click it before the page had been loaded, but that did not fix the issue. On page load, the divs are set to display:none and then I use JS to modify the style property. You can view the issue here

Here is my JavaScript code:

    <script type="text/javascript" />
    function showPost(id) {
if(document.getElementById('post').style.display == 'block' && id == 'send') {
    document.getElementById('post').style.display = 'none';
    document.getElementById(id).style.display = 'block';
}
else if(document.getElementById('send').style.display == 'block' && id == 'post') {
    document.getElementById('send').style.display = 'none';
    document.getElementById(id).style.display = 'block';
}
else if(document.getElementById(id).style.display == 'none') {
    document.getElementById(id).style.display = 'block';
}
else {
    document.getElementById(id).style.display = 'none';
}
    }
    </script>

Thanks!

  • 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-09T08:16:19+00:00Added an answer on June 9, 2026 at 8:16 am

    The post and send elements don’t seem to have the style attribute on load. It doesn’t help to have the display:none in the css only, it needs to be applied to the element itself.

    Adding style="display:none;" to both elements will solve your problem.

    <div id="post" style="display: none;">
    <div id="send" style="display: none;">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some issues showing a div that i am hiding. For some
I'm having an issue with showing a div after clicking a link. When I
Hi guys I am having issue I have this query: SELECT * FROM useraccount
Just started mongo and started having issue with querying already. i have a collection
Having an issue here that I have tried everything I can think of but
I am having issue while showing a WebView in an activity in the middle
I'm having an issue with exceptions showing app as stack traces in the page.
I'm having a bit of an issue with some CSS. In the main content
I'm having an issue with IE9 showing horizontal scroll bars on a printed page
On the following page: http://jsfiddle.net/3h7pL/ I'm having an issue where the submenu isn't showing

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.