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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:33:37+00:00 2026-06-09T17:33:37+00:00

How can I show an item with jQuery, using slideToggle , fadeIn , or

  • 0

How can I show an item with jQuery, using slideToggle, fadeIn, or a similar function, that is initially hidden and also uses a css attribute besides display:block? I know I can add style="display:none" in the html and style the css as I’d like it when visible, but is there a way that uses only css? Or a another way that has advantages? Having to use this technique to “trick” jQuery into using display:inline when it shows the element is not intuitive and might be hard to debug later. Here is an example using the trick (I am keeping both divs inline, even after the second is displayed).

jsFiddle

<div id="a">hello</div>
<div id="b" style="display:none">world</div>
<button>show world</button>​

js:

$("button").click(function(){
    $("#b").fadeIn();
});​

css:

div{
   display:inline;    
}​
  • 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-09T17:33:39+00:00Added an answer on June 9, 2026 at 5:33 pm

    Thanks to the other answerers, but after some more research I think I’ve found an answer that’s slightly cleaner. Just modify the fadeIn statement with a call to css(display:whatever) in order to modify the outcome. Since fadeIn and the other jQuery effects are asynchronous, it shouldn’t cause any graphical glitches. With this method, the css only affects initial styling, there are no style attributes in the html, and the intent and effect of the jQuery statement is obvious. Thanks to jQuery forum user godsbest for the idea.

    jsFiddle

    <div id="a">hello</div>
    <div id="b">world</div>
    <button>show world</button>​
    

    js:

    $("button").click(function(){
        $("#b").fadeIn().css("display","inline");
    });​
    

    css:

    #a{
       display:inline;    
    }
    #b{
       display:none;        
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a context-menu item click to show a dialog (using JQuery/Bootstrap) that lets
Take a look at this: http://thebekker.dk/_skole/GFeksamen/ You can see the 2nd menu item show
can anyone recommend a website crawler that can show me all of the links
It seems that we can show layers and even use a different zPosition for
if so can show simple example, ex in jquery ajax.post
I know that you can show current GPS moving location on map with WP7
I've an application that you can show and close several Dialogs with: showDialog(...) removeDialog(...)
I'm using jquery to animate a dropdown menu. The children of a menu-item are
I'm using jQuery Autocomplete plugin which, generates following markup when suggestions show up. <ul
I have a code in javascript and I am using jQuery Calculation plugin (can

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.