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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:41:04+00:00 2026-05-18T00:41:04+00:00

Note: I’ve found the causant of my problem. See below for more info. I’ll

  • 0

Note: I’ve found the causant of my problem. See below for more info.

I’ll be concise. Here’s my scenario:

The HTML file:

<form id="login">
<label for="editable">i'm a label for editable</label>
<input id="editable" type="text" />
</form>

The CSS file:

#login label { display: block }

The JS file:

$(document).ready(function() {
  $('#login label').hide().show();
});

The desired behavior is to show the element again with the same CSS properties (display: block), but in the DOM it seems that the label element gets another (maybe the default?) ones (in this case, display: inline). Note: I’ve checked the HTML and CSS files. Everything is correct. The problem is in the javascript file.

Seen on jQuery’s API docs, concerning .hide() method:

With no parameters, the .hide() method is the simplest way to hide an element:

$(‘.target’).hide();

The matched elements will be hidden immediately, with no animation. This is roughly equivalent to calling .css(‘display’, ‘none’), except that the value of the display property is saved in jQuery’s data cache so that display can later be restored to its initial value. If an element has a display value of inline, then is hidden and shown, it will once again be displayed inline.

Seen on jQuery’s API docs, concerning .show() method:

With no parameters, the .show() method is the simplest way to display an element:

$(‘.target’).show();

The matched elements will be revealed immediately, with no animation. This is roughly equivalent to calling .css(‘display’, ‘block’), except that the display property is restored to whatever it was initially. If an element has a display value of inline, then is hidden and shown, it will once again be displayed inline.

Am I missing something? I’m wrong? Or is just a not desired behavior?

Thanks in advance.

Solution

Include the CSS first, then the JS later.

  • 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-05-18T00:41:05+00:00Added an answer on May 18, 2026 at 12:41 am

    Include the CSS first, then the JS later.

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

Sidebar

Related Questions

NOTE : I am asking for real world problem, not for theoretical purpose; see
Note: See the bottom of this post for an explanation for why this wasn't
Note The question below was asked in 2008 about some code from 2003. As
NOTE: program in java, server uses php, and mysql...file is .log or .txt file
(Note: This post has been edited to show specific use case. See bottom.) I
NOTE : My specific problem is solved (explained at the bottom), but I'll leave
NOTE: The scenario is using 2 entity framework models to sync data between 2
Note: The answers & comments below reflect the state of legacy browsers in 2009.
(Note: the data here is a made up example since I can't post the
Note: the below code is just for demonstration and I am using jQuery and

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.